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
PlaceholderFactory.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Config\Model\Placeholder
;
7
8
use
Magento\Framework\Exception\LocalizedException
;
9
use
Magento\Framework\ObjectManagerInterface
;
10
15
class
PlaceholderFactory
16
{
20
const
TYPE_ENVIRONMENT
=
'environment'
;
21
25
private
$objectManager;
26
30
private
$types;
31
36
public
function
__construct
(
ObjectManagerInterface
$objectManager, array $types = [])
37
{
38
$this->objectManager =
$objectManager
;
39
$this->types = $types;
40
}
41
50
public
function
create
(
$type
)
51
{
52
if
(!isset($this->types[
$type
])) {
53
throw
new
LocalizedException
(
__
(
'There is no defined type '
.
$type
));
54
}
55
56
$object = $this->objectManager->create($this->types[
$type
]);
57
58
if
(!$object instanceof
PlaceholderInterface
) {
59
throw
new
LocalizedException
(
__
(
'Object is not instance of '
. PlaceholderInterface::class));
60
}
61
62
return
$object;
63
}
64
}
Magento\Framework\Exception\LocalizedException
Definition:
LocalizedException.php:17
Magento\Config\Model\Placeholder\PlaceholderInterface
Definition:
PlaceholderInterface.php:15
Magento\Config\Model\Placeholder\PlaceholderFactory
Definition:
PlaceholderFactory.php:15
$objectManager
$objectManager
Definition:
bootstrap.php:17
Magento\Framework\ObjectManagerInterface
Definition:
ObjectManagerInterface.php:12
Magento\Config\Model\Placeholder
Definition:
Environment.php:6
__
__()
Definition:
__.php:13
$type
$type
Definition:
item.phtml:13
Magento\Config\Model\Placeholder\PlaceholderFactory\__construct
__construct(ObjectManagerInterface $objectManager, array $types=[])
Definition:
PlaceholderFactory.php:36
Magento\Config\Model\Placeholder\PlaceholderFactory\TYPE_ENVIRONMENT
const TYPE_ENVIRONMENT
Definition:
PlaceholderFactory.php:20
Magento\Config\Model\Placeholder\PlaceholderFactory\create
create($type)
Definition:
PlaceholderFactory.php:50