Exemple #1
0
 /**
  * @param string $className
  * @return string 
  */
 public function getServiceName($className)
 {
     $model = $this->services->find(function (ModelService $model) use($className) {
         return $model->getClassName() == $className;
     });
     if (!is_null($model)) {
         return $model->getServiceName();
     }
     "";
 }
Exemple #2
0
 public function buildRoutes()
 {
     $result = [];
     foreach ($this->routers->map(function (ModelRoute $m) {
         return $m->getRoutes();
     }) as $data) {
         $result[] = implode("\n", $data);
     }
     return implode("\n", $result);
 }
Exemple #3
0
 public function getRoutesForMethod($method, ArrayList $list)
 {
     return $list->filter(function (Annotation $a) {
         return $a->getName() == PluginRoute::ROUTE_ANNOTATION;
     })->map(function (Annotation $a) use($method) {
         return $this->buildRoute($a, $method);
     })->filter(function ($data) {
         return count($data) > 0;
     })->toArray();
 }
Exemple #4
0
 private function buildTasks()
 {
     $result = [];
     $this->tasks->map(function (ModelTask $model) {
         return $model->getTasks();
     })->filter(function ($data) {
         return count($data) > 0;
     })->each(function ($data) use(&$result) {
         $result = array_merge($result, $data);
     });
     return $result;
 }
Exemple #5
0
 private function buildListeners()
 {
     $result = [];
     $this->listeners->map(function (ModelListener $model) {
         return $model->getListeners();
     })->filter(function ($data) {
         return count($data) > 0;
     })->each(function ($data) use(&$result) {
         $result = array_merge($result, $data);
     });
     return $result;
 }
 public function getMethods($annotationName)
 {
     $result = [];
     if ($this->reflection->getMethodsAnnotations() !== false) {
         foreach ($this->reflection->getMethodsAnnotations() as $method => $annotations) {
             $list = ArrayList::create($annotations->getAnnotations());
             if ($list->find(function (Annotation $annotation) use($annotationName) {
                 return $annotation->getName() == $annotationName;
             }) != null) {
                 $result[$method] = $list;
             }
         }
     }
     return $result;
 }
Exemple #7
0
 private function findEventName(ArrayList $list)
 {
     return $list->find(function (Annotation $annotation) {
         return $annotation->getName() == PluginListener::EVENT_ANNOTATION;
     })->getArgument(0);
 }
Exemple #8
0
 private function getPropertyValue($field, ArrayList $list)
 {
     $property = $list->find(function (Annotation $annotation) {
         return $annotation->getName() == PluginService::PROPERTY_ANNOTATION_VALUE;
     });
     $valueName = $property->getArgument(0);
     if (!is_null($valueName)) {
         $definition = sprintf("\t\t\t\t\t'name' => '%s',\n", $field);
         $pattern = "\t\t\t\t\t'value' => ['type' => 'parameter', 'value' => '%s']";
         $c = $this->getParameterValue;
         return $definition . sprintf($pattern, $c($valueName));
     }
     Logger::getInstance()->warning("Annotation Value required name");
     return "";
 }
Exemple #9
0
 /**
  * 
  * @param ArrayList $list
  * @return Annotation
  */
 private function findTaskAnnotation(ArrayList $list)
 {
     return $list->find(function (Annotation $annotation) {
         return $annotation->getName() == PluginTask::METHOD_ANNOTATION;
     });
 }