Skip to content

Commit 1782c54

Browse files
Stanislav Idolovmageprince
Stanislav Idolov
authored andcommitted
Minor fixes
1 parent 311f8ca commit 1782c54

File tree

1 file changed

+10
-6
lines changed
  • lib/internal/Magento/Framework/View/Asset

1 file changed

+10
-6
lines changed

lib/internal/Magento/Framework/View/Asset/Merged.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Framework\View\Asset;
77

8+
use Magento\Framework\App\ObjectManager;
9+
810
/**
911
* \Iterator that aggregates one or more assets and provides a single public file with equivalent behavior
1012
*/
@@ -56,21 +58,23 @@ class Merged implements \Iterator
5658
* @param \Psr\Log\LoggerInterface $logger
5759
* @param MergeStrategyInterface $mergeStrategy
5860
* @param \Magento\Framework\View\Asset\Repository $assetRepo
59-
* @param \Magento\Framework\App\View\Deployment\Version\StorageInterface $versionStorage
6061
* @param MergeableInterface[] $assets
62+
* @param \Magento\Framework\App\View\Deployment\Version\StorageInterface $versionStorage
6163
* @throws \InvalidArgumentException
6264
*/
6365
public function __construct(
6466
\Psr\Log\LoggerInterface $logger,
6567
MergeStrategyInterface $mergeStrategy,
6668
\Magento\Framework\View\Asset\Repository $assetRepo,
67-
\Magento\Framework\App\View\Deployment\Version\StorageInterface $versionStorage,
68-
array $assets
69+
array $assets,
70+
\Magento\Framework\App\View\Deployment\Version\StorageInterface $versionStorage = null
6971
) {
7072
$this->logger = $logger;
7173
$this->mergeStrategy = $mergeStrategy;
7274
$this->assetRepo = $assetRepo;
73-
$this->versionStorage = $versionStorage;
75+
$this->versionStorage = $versionStorage ?: ObjectManager::getInstance()->get(
76+
\Magento\Framework\App\View\Deployment\Version\StorageInterface::class
77+
);
7478

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

130-
$version=$this->versionStorage->load();
134+
$version = $this->versionStorage->load();
131135
if ($version) {
132-
$paths[]=$version;
136+
$paths[] = $version;
133137
}
134138

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

0 commit comments

Comments
 (0)