private function writeChildren($children)
 {
     if (null === $children) {
         // getDeclaredChildNodeDefinitions is allowed to return null on
         // newly created node type definitions
         return '';
     }
     $s = '';
     /** @var $child NodeDefinitionInterface */
     foreach ($children as $child) {
         $this->checkNamespace($child->getName());
         $s .= '+ ' . $child->getName();
         if ($child->getRequiredPrimaryTypeNames()) {
             foreach ($child->getRequiredPrimaryTypeNames() as $typeName) {
                 $this->checkNamespace($typeName);
             }
             $s .= ' (' . implode(', ', $child->getRequiredPrimaryTypeNames()) . ')';
         }
         if ($child->getDefaultPrimaryTypeName()) {
             $this->checkNamespace($child->getDefaultPrimaryTypeName());
             $s .= "\n= " . $child->getDefaultPrimaryTypeName();
         }
         $s .= "\n";
         $attributes = '';
         if ($child->isMandatory()) {
             $attributes .= 'mandatory ';
         }
         if ($child->isAutoCreated()) {
             $attributes .= 'autocreated ';
         }
         if ($child->isProtected()) {
             $attributes .= 'protected ';
         }
         if (OnParentVersionAction::COPY != $child->getOnParentVersion()) {
             $attributes .= OnParentVersionAction::nameFromValue($child->getOnParentVersion()) . ' ';
         }
         if ($child->allowsSameNameSiblings()) {
             $attributes .= 'sns ';
         }
         if ($attributes) {
             $s .= trim($attributes) . "\n";
         }
     }
     return $s;
 }
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testNameFromValueInvalid()
 {
     OnParentVersionAction::nameFromValue(-1);
 }
 private function getItemDefinitionArray(ItemDefinitionInterface $id)
 {
     return array('name' => $id->getName(), 'auto_created' => (bool) $id->isAutoCreated(), 'mandatory' => (bool) $id->isMandatory(), 'on_parent_version' => OnParentVersionAction::nameFromValue($id->getOnParentVersion()), 'protected' => (bool) $id->isProtected());
 }