Skip to content

Commit

Permalink
Clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
magiccart committed Jan 4, 2023
1 parent 44e6cf7 commit ed59564
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions Block/InfiniteScroll.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,17 @@

class InfiniteScroll extends \Magento\Framework\View\Element\Template
{
/**
* Store manager
*
* @var \Magento\Store\Model\StoreManagerInterface
*/
private $storeManager;

/**
* InfiniteScroll constructor.
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Store\Model\StoreManagerInterface $storeManager,
array $data = []
) {
parent::__construct($context, $data);
$this->storeManager = $storeManager;
}


Expand All @@ -39,8 +30,9 @@ public function getMedia($img = null): string
{
$urlMedia = '';
try {
$urlMedia = $this->storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
$urlMedia = $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
} catch (NoSuchEntityException $e) {
echo 'Error: ' . $e;
}

return $img ? $urlMedia . $img : $urlMedia;
Expand Down

0 comments on commit ed59564

Please sign in to comment.