Exemplo n.º 1
0
 /**
  * Utility function for push without variable args.
  * Push one Property instance or array|\Traversable of such instances.
  * @return void
  * @param Property|array|\Traversable $item
  * @throws \UnexpectedValueException If any individual value is not a 
  * Property.
  */
 private function pushOneArg($item)
 {
     if ($item instanceof Property) {
         if ('uid' === $item->getName()) {
             $this->setUID($item->getValue());
         } elseif ($item->getSpecification()->requiresSingleProperty()) {
             $this->data[$item->getName()] = $item;
         } else {
             $this->data[$item->getName()][] = $item;
         }
     } elseif (is_array($item) || $item instanceof \Traversable) {
         foreach ($item as $property) {
             $this->pushOneArg($property);
         }
     } else {
         throw new \UnexpectedValueException('Not a property');
     }
 }