![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/extmag/shiplab/Helper/ |
<?php /** * Copyright © Extmag. All rights reserved. */ namespace Extmag\Shiplab\Helper; use Magento\Framework\App\Helper\AbstractHelper; use Magento\Framework\App\Helper\Context; use Magento\Framework\Exception\FileSystemException; use Magento\Framework\Filesystem\DirectoryList; use Magento\Framework\UrlInterface; class Url extends AbstractHelper { /** * @var UrlInterface */ public $urlBuilder; /** * @var DirectoryList */ protected $dir; /** * @param Context $context * @param DirectoryList $dir */ public function __construct( Context $context, DirectoryList $dir ) { $this->urlBuilder = $context->getUrlBuilder(); parent::__construct($context); $this->dir = $dir; } /** * @param $carrier * @param $type * @param $extension * @return string */ public function getExtmagMediaPath($carrier, $type, $extension) { return "extmag/" . strtolower($carrier) . "/" . strtolower($type) . "/" . ($extension !== null ? (strtolower($extension) . "/") : ''); } /** * @return string */ public function getMediaUrl() { return $this->urlBuilder->getBaseUrl(['_type' => $this->urlBuilder::URL_TYPE_MEDIA]); } /** * @return string * @throws FileSystemException */ public function getMediaPath() { return $this->dir->getPath($this->urlBuilder::URL_TYPE_MEDIA); } }