Skip to content

Commit 76ba852

Browse files
committed
Fixed static tests
1 parent 4b6e8f6 commit 76ba852

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/code/Magento/MediaContent/Model/ExtractAssetsFromContent.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __construct(
5353
*/
5454
public function execute(string $content): array
5555
{
56-
$paths = [];
56+
$matchesArrays = [];
5757

5858
foreach ($this->searchPatternConfig->get() as $pattern) {
5959
if (empty($pattern)) {
@@ -63,11 +63,11 @@ public function execute(string $content): array
6363
preg_match_all($pattern, $content, $matches, PREG_PATTERN_ORDER);
6464

6565
if (!empty($matches[1])) {
66-
$paths = array_merge($paths, array_unique($matches[1]));
66+
$matchesArrays[] = $matches[1];
6767
}
6868
}
6969

70-
return $this->getAssetsByPaths(array_unique($paths));
70+
return $this->getAssetsByPaths(array_unique(array_merge([], ...$matchesArrays)));
7171
}
7272

7373
/**
@@ -104,7 +104,7 @@ private function getAssetsByPaths(array $paths): array
104104
private function getPathStartingWithSlash(string $path): string
105105
{
106106
$normalizedPath = ltrim($path, '/');
107-
if (strpos($normalizedPath, '/')) {
107+
if (strpos($normalizedPath, '/') === false) {
108108
return $normalizedPath;
109109
}
110110
return '/' . $normalizedPath;

0 commit comments

Comments
 (0)