Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-config
Model
Config
Parser
Comment.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Config\Model\Config\Parser
;
7
8
use
Magento\Config\Model\Placeholder\Environment
;
9
use
Magento\Config\Model\Placeholder\PlaceholderInterface
;
10
use
Magento\Framework\App\Config\CommentParserInterface
;
11
use
Magento\Framework\App\Config\ScopeConfigInterface
;
12
use
Magento\Framework\App\Filesystem\DirectoryList
;
13
use
Magento\Framework\Exception\FileSystemException
;
14
use
Magento\Framework\Filesystem
;
15
24
class
Comment
implements
CommentParserInterface
25
{
29
private
$filesystem;
30
34
private
$placeholder;
35
40
public
function
__construct
(
41
Filesystem
$filesystem,
42
PlaceholderInterface
$placeholder
43
) {
44
$this->filesystem =
$filesystem
;
45
$this->placeholder = $placeholder;
46
}
47
89
public
function
execute
(
$fileName
)
90
{
91
$fileContent = $this->filesystem
92
->getDirectoryRead(
DirectoryList::CONFIG
)
93
->readFile(
$fileName
);
94
95
$pattern
= sprintf(
'/\s+\*\s+(?P<placeholder>%s.*?)\s/'
, preg_quote(Environment::PREFIX));
96
preg_match_all(
$pattern
, $fileContent, $matches);
97
98
if
(!isset($matches[
'placeholder'
])) {
99
return
[];
100
}
101
102
$configs = [];
103
foreach
($matches[
'placeholder'
] as $placeholder) {
104
$path
= $this->placeholder->restore($placeholder);
105
$path
= preg_replace(
'/^'
.
ScopeConfigInterface::SCOPE_TYPE_DEFAULT
.
'\//'
,
''
,
$path
);
106
$configs[$placeholder] =
$path
;
107
}
108
109
return
$configs;
110
}
111
}
Magento\Config\Model\Placeholder\PlaceholderInterface
Definition:
PlaceholderInterface.php:15
Magento\Framework\Filesystem
Definition:
Filesystem.php:16
Magento\Framework\Filesystem
$pattern
$pattern
Definition:
website.php:22
Magento\Framework\App\Config\CommentParserInterface
Definition:
CommentParserInterface.php:13
Magento\Framework\App\Filesystem\DirectoryList\CONFIG
const CONFIG
Definition:
DirectoryList.php:28
Magento\Framework\App\Config\ScopeConfigInterface\SCOPE_TYPE_DEFAULT
const SCOPE_TYPE_DEFAULT
Definition:
ScopeConfigInterface.php:20
Magento\Config\Model\Config\Parser\Comment
Definition:
Comment.php:24
Magento\Framework\Exception\FileSystemException
Definition:
FileSystemException.php:14
Magento\Config\Model\Config\Parser
Definition:
Comment.php:6
$fileName
$fileName
Definition:
translate.phtml:15
Magento\Config\Model\Config\Parser\Comment\__construct
__construct(Filesystem $filesystem, PlaceholderInterface $placeholder)
Definition:
Comment.php:40
Magento\Framework\App\Filesystem\DirectoryList
Definition:
DirectoryList.php:13
Magento\Config\Model\Placeholder\Environment
Definition:
Environment.php:16
Magento\Framework\App\Config\ScopeConfigInterface
Definition:
ScopeConfigInterface.php:15
$filesystem
$filesystem
Definition:
validate_image.php:10
Magento\Framework\App\Config\CommentParserInterface\execute
execute($fileName)
$path
$path
Definition:
import_with_filesystem_images.php:14