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
framework-message-queue
Consumer
Config
Validator
Handlers.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Framework\MessageQueue\Consumer\Config\Validator
;
7
8
use
Magento\Framework\MessageQueue\Consumer\Config\ValidatorInterface
;
9
use
Magento\Framework\Reflection\MethodsMap
;
10
14
class
Handlers
implements
ValidatorInterface
15
{
19
private
$methodsMap;
20
26
public
function
__construct
(
MethodsMap
$methodsMap)
27
{
28
$this->methodsMap = $methodsMap;
29
}
30
34
public
function
validate
(
$configData
)
35
{
36
foreach
(
$configData
as $consumerConfig) {
37
$consumerName = $consumerConfig[
'name'
];
38
if
(!is_array($consumerConfig[
'handlers'
])) {
39
throw
new \LogicException(
40
sprintf(
41
"'handlers' element must be an array for consumer '%s'"
,
42
$consumerName
43
)
44
);
45
}
46
foreach
($consumerConfig[
'handlers'
] as
$handler
) {
47
$this->validateHandler(
$handler
, $consumerName);
48
}
49
}
50
}
51
60
private
function
validateHandler(
$handler
, $consumerName)
61
{
62
if
(!isset(
$handler
[
'type'
]) || !isset(
$handler
[
'method'
])) {
63
throw
new \LogicException(
64
sprintf(
65
"'%s' consumer declaration is invalid. "
66
.
"Every handler element must be an array. It must contain 'type' and 'method' elements."
,
67
$consumerName
68
)
69
);
70
}
71
try
{
72
$this->methodsMap->getMethodParams(
$handler
[
'type'
],
$handler
[
'method'
]);
73
}
catch
(\Exception $e) {
74
throw
new \LogicException(
75
sprintf(
76
'Service method specified as handler for of consumer "%s" is not available. Given "%s"'
,
77
$consumerName,
78
$handler
[
'type'
] .
'::'
.
$handler
[
'method'
]
79
)
80
);
81
}
82
}
83
}
Magento\Framework\MessageQueue\Consumer\Config\Validator
Definition:
ConsumerInstance.php:6
Magento\Framework\MessageQueue\Consumer\Config\ValidatorInterface
Definition:
ValidatorInterface.php:11
Magento\Framework\MessageQueue\Consumer\Config\Validator\Handlers\__construct
__construct(MethodsMap $methodsMap)
Definition:
Handlers.php:26
$configData
$configData
Definition:
payment_configuration.php:26
Magento\Framework\MessageQueue\Consumer\Config\Validator\Handlers\validate
validate($configData)
Definition:
Handlers.php:34
Magento\Framework\Reflection\MethodsMap
Definition:
MethodsMap.php:18
Magento\Framework\MessageQueue\Consumer\Config\Validator\Handlers
Definition:
Handlers.php:14
$handler
catch(\Exception $e) $handler
Definition:
index.php:30