/**
  * @param  AbstractNode $node
  * @param  bool         $embedded
  * @return array
  */
 public function getArray(AbstractNode $node, $embedded = false)
 {
     if (!$node instanceof AttributeNode) {
         throw new \InvalidArgumentException("Invalid node type!");
     }
     if (!$embedded) {
         return array($node->getFormattedName() => $node->getValue());
     }
     return $node->getValue();
 }
 /**
  * @param  AbstractNode $node
  * @param  bool         $embedded
  * @return array
  */
 public function getArray(AbstractNode $node, $embedded = false)
 {
     if (!$node instanceof ArrayNode) {
         throw new \InvalidArgumentException("Invalid node type!");
     }
     $array = array();
     foreach ($node->getNodes() as $index => $childNode) {
         $array[$index] = $this->getMainHandler()->getArray($childNode, true);
     }
     return $array;
 }
 /**
  * @param  AbstractNode $node
  * @param  bool         $embedded
  * @return array
  */
 public function getArray(AbstractNode $node, $embedded = false)
 {
     if (!$node instanceof ObjectNode) {
         throw new \InvalidArgumentException("Invalid node type!");
     }
     $array = array();
     foreach ($node->getAttributes() as $attribute) {
         $array[$attribute->getFormattedName()] = $this->getMainHandler()->getArray($attribute, true);
     }
     foreach ($node->getNodes() as $name => $childNode) {
         $array[$name] = $this->getMainHandler()->getArray($childNode, true);
     }
     return $array;
 }