/** * @param Node $node * @param Context $context * @throws TypeNotSupportedException * @return Node the resolved node */ public function resolve(Node $node, Context $context) { if (!$node->hasType()) { $node = $this->baseResolver->resolve($node, $context); foreach ($node->getChildNodes() as $childNodes) { $this->resolve($childNodes, $context); } } return $node; }
/** * @param Node $node * @param Context $context * @throws TypeNotSupportedException * @return Node the resolved node */ public function resolve(Node $node, Context $context) { if (!$node->hasType()) { foreach ($this->resolvers as $resolver) { try { return $resolver->resolve($node, $context); } catch (TypeNotSupportedException $ex) { // No problem, just try the next one } } throw new TypeNotSupportedException(); } return $node; }
/** * @param Node $node * @param Context $context * @throws TypeNotSupportedException * @return Node the resolved node */ public function resolve(Node $node, Context $context) { if (!$node->hasType()) { $data = $node->getData(); if ($this->supports($data)) { $node->setType($this->getType()); foreach ($this->getProperties($data) as $key => $value) { $childNode = $context->getNodeForData($value); $node->addChildNode($key, $childNode); } } else { throw new TypeNotSupportedException(); } } return $node; }