Skip to content

Commit c13a5fb

Browse files
committed
magento/magento#227499: Intorduced ConfigInterface
1 parent 6dfb2cc commit c13a5fb

File tree

5 files changed

+29
-18
lines changed

5 files changed

+29
-18
lines changed

app/code/Magento/MediaGallery/Model/Directory/Config.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/**
1313
* Media gallery directory config
1414
*/
15-
class Config
15+
class Config implements ConfigInterface
1616
{
1717
private const XML_PATH_BLACKLIST_PATTERNS = 'blacklist/patterns';
1818

@@ -29,25 +29,13 @@ public function __construct(DataInterface $data)
2929
$this->data = $data;
3030
}
3131

32-
/**
33-
* Get config value by key.
34-
*
35-
* @param string|null $key
36-
* @param string|null $default
37-
* @return array
38-
*/
39-
public function get($key = null, $default = null)
40-
{
41-
return $this->data->get($key, $default);
42-
}
43-
4432
/**
4533
* Returns list of blacklist regexp patterns
4634
*
4735
* @return array
4836
*/
4937
public function getBlacklistPatterns() : array
5038
{
51-
return $this->get(self::XML_PATH_BLACKLIST_PATTERNS);
39+
return $this->data->get(self::XML_PATH_BLACKLIST_PATTERNS);
5240
}
5341
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\MediaGallery\Model\Directory;
9+
10+
/**
11+
* Media gallery directory config
12+
*/
13+
interface ConfigInterface
14+
{
15+
/**
16+
* Returns list of blacklist RegEx patterns
17+
*
18+
* @return array
19+
*/
20+
public function getBlacklistPatterns(): array;
21+
}

app/code/Magento/MediaGallery/Model/Directory/IsBlacklisted.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
class IsBlacklisted implements IsPathBlacklistedInterface
1616
{
1717
/**
18-
* @var Config
18+
* @var ConfigInterface
1919
*/
2020
private $config;
2121

2222
/**
23-
* @param Config $config
23+
* @param ConfigInterface $config
2424
*/
25-
public function __construct(Config $config)
25+
public function __construct(ConfigInterface $config)
2626
{
2727
$this->config = $config;
2828
}

app/code/Magento/MediaGallery/etc/di.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
<preference for="Magento\MediaGalleryApi\Api\Data\AssetInterface" type="Magento\MediaGallery\Model\Asset"/>
1111
<preference for="Magento\MediaGalleryApi\Api\Data\AssetKeywordsInterface" type="Magento\MediaGallery\Model\AssetKeywords"/>
1212

13+
<preference for="Magento\MediaGallery\Model\Directory\ConfigInterface" type="Magento\MediaGallery\Model\Directory\Config"/>
14+
1315
<preference for="Magento\MediaGalleryApi\Model\Asset\Command\GetByIdInterface" type="Magento\MediaGallery\Model\Asset\Command\GetById"/>
1416
<preference for="Magento\MediaGalleryApi\Model\Asset\Command\SaveInterface" type="Magento\MediaGallery\Model\Asset\Command\Save"/>
1517
<preference for="Magento\MediaGalleryApi\Model\Asset\Command\GetByPathInterface" type="Magento\MediaGallery\Model\Asset\Command\GetByPath"/>

app/code/Magento/MediaGalleryApi/etc/directory.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<xs:complexType name="patternsType">
3030
<xs:annotation>
3131
<xs:documentation>
32-
List of directory paths regexp patterns
32+
List of directory paths RegExp patterns
3333
</xs:documentation>
3434
</xs:annotation>
3535
<xs:sequence>

0 commit comments

Comments
 (0)