Ejemplo n.º 1
0
 public function serializeAnnArgs(Annotation $ann)
 {
     $args = [];
     foreach ($ann->getArgs() as $arg) {
         if ($arg instanceof Annotation) {
             $arg = $this->serializeAnnArgs($arg);
         }
         $args[] = $arg;
     }
     return $args;
 }
Ejemplo n.º 2
0
 protected function getAnnotationArgs(\Notoj\Annotation\Annotation $annotation)
 {
     $args = $annotation->getArgs();
     if (empty($args[0])) {
         $args[0] = array();
     }
     if (empty($args[1])) {
         $args[1] = NULL;
     }
     if (is_string($args[0])) {
         $args[1] = $args[0];
         $args[0] = array();
     }
     return $args;
 }
Ejemplo n.º 3
0
 public static function getApplications(Annotation $annotation)
 {
     $object = $annotation->getObject();
     $apps = [];
     foreach ($object->get('app,application') as $app) {
         $apps[] = strtolower(trim(current($app->getArgs()) ?: ''));
     }
     if ($object instanceof ZMethod) {
         foreach ($object->getClass()->get('app,application') as $app) {
             $apps[] = strtolower(trim(current($app->getArgs()) ?: ''));
         }
     }
     return array_unique(array_filter($apps)) ?: ['default'];
 }
Ejemplo n.º 4
0
 public function fromCache(array $cache)
 {
     $annotations = new self();
     foreach ($cache as $object => $ann) {
         $object = unserialize($object);
         $ann = array_map(function ($a) {
             return Annotation::fromCache($a);
         }, $ann);
         $obj = new self($ann);
         if ($object) {
             $obj->setObject($object);
         }
         $annotations->merge($obj);
     }
     return $annotations;
 }