Author: Piotr Olaszewski (piotroo89@gmail.com)
Example #1
0
 /**
  * @param Node $node
  * @return array
  */
 private function attributes(Node $node)
 {
     if ($node->isArray()) {
         $attributes = ['name' => $node->getSanitizedName(), 'type' => 'ns:' . $node->getNameForArray()];
     } elseif ($node->isObject()) {
         $attributes = ['name' => $node->getSanitizedName(), 'element' => 'ns:' . $node->getNameForObject()];
     } else {
         $attributes = ['name' => $node->getSanitizedName(), 'type' => 'xsd:' . $node->getType()];
     }
     return $attributes;
 }
Example #2
0
 /**
  * @test
  */
 public function shouldReturnTrueWhenTypeIsObject()
 {
     //given
     $elements = [new Node('string', '$name', false)];
     $node = new Node('object', '$users', true, $elements);
     //when
     $isArray = $node->isObject();
     //then
     $this->assertTrue($isArray);
 }