Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Idolov authored and mageprince committed Jul 9, 2018
1 parent 311f8ca commit 1782c54
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/internal/Magento/Framework/View/Asset/Merged.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/
namespace Magento\Framework\View\Asset;

use Magento\Framework\App\ObjectManager;

/**
* \Iterator that aggregates one or more assets and provides a single public file with equivalent behavior
*/
Expand Down Expand Up @@ -56,21 +58,23 @@ class Merged implements \Iterator
* @param \Psr\Log\LoggerInterface $logger
* @param MergeStrategyInterface $mergeStrategy
* @param \Magento\Framework\View\Asset\Repository $assetRepo
* @param \Magento\Framework\App\View\Deployment\Version\StorageInterface $versionStorage
* @param MergeableInterface[] $assets
* @param \Magento\Framework\App\View\Deployment\Version\StorageInterface $versionStorage
* @throws \InvalidArgumentException
*/
public function __construct(
\Psr\Log\LoggerInterface $logger,
MergeStrategyInterface $mergeStrategy,
\Magento\Framework\View\Asset\Repository $assetRepo,
\Magento\Framework\App\View\Deployment\Version\StorageInterface $versionStorage,
array $assets
array $assets,
\Magento\Framework\App\View\Deployment\Version\StorageInterface $versionStorage = null
) {
$this->logger = $logger;
$this->mergeStrategy = $mergeStrategy;
$this->assetRepo = $assetRepo;
$this->versionStorage = $versionStorage;
$this->versionStorage = $versionStorage ?: ObjectManager::getInstance()->get(
\Magento\Framework\App\View\Deployment\Version\StorageInterface::class
);

if (!$assets) {
throw new \InvalidArgumentException('At least one asset has to be passed for merging.');
Expand Down Expand Up @@ -127,9 +131,9 @@ private function createMergedAsset(array $assets)
}
$paths = array_unique($paths);

$version=$this->versionStorage->load();
$version = $this->versionStorage->load();
if ($version) {
$paths[]=$version;
$paths[] = $version;
}

$filePath = md5(implode('|', $paths)) . '.' . $this->contentType;
Expand Down

0 comments on commit 1782c54

Please sign in to comment.