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
Placeholder
Environment.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Config\Model\Placeholder
;
7
8
use
Magento\Framework\App\Config\ScopeConfigInterface
;
9
use
Magento\Framework\App\DeploymentConfig
;
10
16
class
Environment
implements
PlaceholderInterface
17
{
21
const
PREFIX
=
'CONFIG__'
;
22
26
private
$deploymentConfig;
27
31
public
function
__construct
(
DeploymentConfig
$deploymentConfig)
32
{
33
$this->deploymentConfig =
$deploymentConfig
;
34
}
35
42
public
function
generate
(
$path
, $scopeType =
ScopeConfigInterface::SCOPE_TYPE_DEFAULT
, $scopeCode =
null
)
43
{
44
$parts = $scopeType ? [$scopeType] : [];
45
46
if
($scopeType !==
ScopeConfigInterface::SCOPE_TYPE_DEFAULT
&& $scopeCode) {
47
$parts[] = $scopeCode;
48
}
49
50
$parts[] =
$path
;
51
52
$template
= implode(
'__'
, $parts);
53
$template
= str_replace(
'/'
,
'__'
,
$template
);
54
$template
= static::PREFIX .
$template
;
55
$template
= strtoupper(
$template
);
56
57
return
$template
;
58
}
59
64
public
function
restore
(
$template
)
65
{
66
$template
= preg_replace(
'/^'
. static::PREFIX .
'/'
,
''
,
$template
);
67
$template
= str_replace(
'__'
,
'/'
,
$template
);
68
$template
= strtolower(
$template
);
69
70
return
$template
;
71
}
72
77
public
function
isApplicable
($placeholder)
78
{
79
return
1 === preg_match(
'/^'
. static::PREFIX .
'([a-zA-Z]+)([a-zA-Z0-9_])*$/'
, $placeholder);
80
}
81
}
Magento\Config\Model\Placeholder\PlaceholderInterface
Definition:
PlaceholderInterface.php:15
Magento\Framework\App\Config\ScopeConfigInterface\SCOPE_TYPE_DEFAULT
const SCOPE_TYPE_DEFAULT
Definition:
ScopeConfigInterface.php:20
Magento\Framework\App\DeploymentConfig
Definition:
DeploymentConfig.php:17
Magento\Config\Model\Placeholder
Definition:
Environment.php:6
$deploymentConfig
$deploymentConfig
Definition:
health_check.php:18
Magento\Config\Model\Placeholder\Environment\PREFIX
const PREFIX
Definition:
Environment.php:21
Magento\Config\Model\Placeholder\Environment\generate
generate($path, $scopeType=ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeCode=null)
Definition:
Environment.php:42
Magento\Config\Model\Placeholder\Environment
Definition:
Environment.php:16
Magento\Config\Model\Placeholder\Environment\isApplicable
isApplicable($placeholder)
Definition:
Environment.php:77
Magento\Config\Model\Placeholder\Environment\restore
restore($template)
Definition:
Environment.php:64
Magento\Framework\App\Config\ScopeConfigInterface
Definition:
ScopeConfigInterface.php:15
$template
$template
Definition:
export.php:12
Magento\Framework\App\DeploymentConfig
Definition:
CommentParser.php:6
$path
$path
Definition:
import_with_filesystem_images.php:14
Magento\Config\Model\Placeholder\Environment\__construct
__construct(DeploymentConfig $deploymentConfig)
Definition:
Environment.php:31