Skip to content

Commit 7beb815

Browse files
committed
#29889: Code review and static tests fixes
1 parent a55b880 commit 7beb815

10 files changed

+23
-8
lines changed

app/code/Magento/MediaGalleryRenditions/Model/Config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class Config
3434

3535
/**
3636
* @param ScopeConfigInterface $scopeConfig
37+
* @param ResourceConnection $resourceConnection
3738
*/
3839
public function __construct(
3940
ScopeConfigInterface $scopeConfig,

app/code/Magento/MediaGalleryRenditions/Model/GenerateRenditions.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ class GenerateRenditions implements GenerateRenditionsInterface
6464
* @param GetRenditionPathInterface $getRenditionPath
6565
* @param Filesystem $filesystem
6666
* @param File $driver
67+
* @param IsPathExcludedInterface $isPathExcluded
68+
* @param LoggerInterface $log
6769
*/
6870
public function __construct(
6971
AdapterFactory $imageFactory,
@@ -121,6 +123,8 @@ public function execute(array $paths): void
121123
*/
122124
private function generateRendition(string $path): void
123125
{
126+
$this->validateAsset($path);
127+
124128
$renditionPath = $this->getRenditionPath->execute($path);
125129
$this->createDirectory($renditionPath);
126130

@@ -137,6 +141,8 @@ private function generateRendition(string $path): void
137141
}
138142

139143
/**
144+
* Ensure valid media asset path is provided for renditions generation
145+
*
140146
* @param string $path
141147
* @throws FileSystemException
142148
* @throws LocalizedException

app/code/Magento/MediaGalleryRenditions/Model/Queue/FetchRenditionPathsBatches.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class FetchRenditionPathsBatches
4444
/**
4545
* @param LoggerInterface $log
4646
* @param Filesystem $filesystem
47-
* @param GetFilesIterator $assetsIterator
47+
* @param GetFilesIterator $getFilesIterator
4848
* @param int $batchSize
4949
* @param array $fileExtensions
5050
*/

app/code/Magento/MediaGalleryRenditions/Model/Queue/UpdateRenditions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function execute(array $paths): void
6969
/**
7070
* Update renditions and log exceptions
7171
*
72-
* @param string[] $paths
72+
* @param string[] $renditionPaths
7373
*/
7474
private function updateRenditions(array $renditionPaths): void
7575
{

app/code/Magento/MediaGalleryRenditions/Plugin/RemoveRenditions.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ public function __construct(
5252
* Remove renditions when assets are removed
5353
*
5454
* @param DeleteAssetsByPathsInterface $deleteAssetsByPaths
55-
* @param \Closure $proceed
55+
* @param null $result
5656
* @param array $paths
57+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
5758
*/
58-
public function aroundExecute(
59+
public function afterExecute(
5960
DeleteAssetsByPathsInterface $deleteAssetsByPaths,
60-
\Closure $proceed,
61+
$result,
6162
array $paths
6263
): void {
63-
$proceed($paths);
6464
$this->removeRenditions($paths);
6565
}
6666

app/code/Magento/MediaGalleryRenditions/Plugin/UpdateRenditionsOnConfigChange.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function afterSave(Value $config, Value $result): Value
5454
* @param Value $value
5555
* @return bool
5656
*/
57-
private function isRenditionsValue(Value $value)
57+
private function isRenditionsValue(Value $value): bool
5858
{
5959
return $value->getPath() === self::XML_PATH_MEDIA_GALLERY_RENDITIONS_WIDTH_PATH
6060
|| $value->getPath() === self::XML_PATH_MEDIA_GALLERY_RENDITIONS_HEIGHT_PATH;

app/code/Magento/MediaGalleryRenditions/composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"php": "~7.3.0||~7.4.0",
66
"magento/framework": "*",
77
"magento/module-media-gallery-renditions-api": "*",
8+
"magento/module-media-gallery-api": "*",
89
"magento/module-media-content-api": "*",
10+
"magento/framework-message-queue": "*",
911
"magento/module-cms": "*"
1012
},
1113
"type": "magento2-module",

app/code/Magento/MediaGalleryRenditions/etc/media_content.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
<pattern name="catalog_image_with_pub">/^\/pub\/?media\/(?:.renditions\/)?(.*)/</pattern>
1616
</patterns>
1717
</search>
18-
</config>
18+
</config>

app/code/Magento/MediaGalleryRenditionsApi/Api/GenerateRenditionsInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
use Magento\Framework\Exception\LocalizedException;
1111

12+
/**
13+
* Generate optimized version of media assets based on configuration for insertion to content
14+
*/
1215
interface GenerateRenditionsInterface
1316
{
1417
/**

app/code/Magento/MediaGalleryRenditionsApi/Api/GetRenditionPathInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
use Magento\Framework\Exception\LocalizedException;
1111

12+
/**
13+
* Based on media assset path provides path to an optimized image version for insertion to the content
14+
*/
1215
interface GetRenditionPathInterface
1316
{
1417
/**

0 commit comments

Comments
 (0)