30 private $booleanUtils;
37 private $argumentInterpreter;
42 private $defaultValue;
56 $this->booleanUtils = $booleanUtils;
57 $this->argumentInterpreter = $argumentInterpreter;
58 $this->defaultValue = $defaultValueProvider;
68 foreach (
$source->getElementsByTagName(
'exchange') as $exchange) {
69 $name = $this->getAttributeValue($exchange,
'name');
70 $connection = $this->getAttributeValue($exchange,
'connection');
73 $exchangeArguments = [];
75 foreach ($exchange->childNodes as $node) {
76 if (!in_array($node->nodeName, [
'binding',
'arguments']) || $node->nodeType != XML_ELEMENT_NODE) {
79 switch ($node->nodeName) {
81 $bindings = $this->processBindings($node, $bindings);
85 $exchangeArguments = $this->processArguments($node);
90 $autoDelete = $this->getAttributeValue($exchange,
'autoDelete',
false);
93 'type' => $this->getAttributeValue($exchange,
'type'),
95 'durable' => $this->booleanUtils->toBoolean($this->getAttributeValue($exchange,
'durable',
true)),
96 'autoDelete' => $this->booleanUtils->toBoolean($autoDelete),
97 'internal' => $this->booleanUtils->toBoolean($this->getAttributeValue($exchange,
'internal',
false)),
98 'bindings' => $bindings,
99 'arguments' => $exchangeArguments,
110 private function getConverter()
112 if (!$this->converter) {
113 $arrayNodeConfig =
new ArrayNodeConfig(
new NodePathMatcher(), [
'argument(/item)+' =>
'name']);
114 $this->converter =
new FlatConverter($arrayNodeConfig);
116 return $this->converter;
125 private function processArguments(\DOMNode $node)
129 foreach ($node->childNodes as $argumentNode) {
130 if ($argumentNode->nodeType != XML_ELEMENT_NODE || $argumentNode->nodeName !=
'argument') {
133 $argumentName = $argumentNode->attributes->getNamedItem(
'name')->nodeValue;
134 $argumentData = $this->getConverter()->convert($argumentNode,
'argument');
135 $output[$argumentName] = $this->argumentInterpreter->evaluate($argumentData);
148 private function getAttributeValue(\DOMNode $node, $attributeName, $default =
null)
150 $item = $node->attributes->getNamedItem($attributeName);
161 private function processBindings($node, $bindings)
163 $bindingArguments = [];
164 $id = $this->getAttributeValue($node,
'id');
165 $isDisabled = $this->booleanUtils->toBoolean(
166 $this->getAttributeValue($node,
'disabled',
false)
172 $bindingArguments = $this->processArguments(
$arguments);
176 'destinationType' => $this->getAttributeValue($node,
'destinationType'),
177 'destination' => $this->getAttributeValue($node,
'destination'),
178 'disabled' => $isDisabled,
179 'topic' => $this->getAttributeValue($node,
'topic'),
180 'arguments' => $bindingArguments
__construct(BooleanUtils $booleanUtils, InterpreterInterface $argumentInterpreter, DefaultValueProvider $defaultValueProvider)
if(!isset($_GET['name'])) $name