/** * @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(); } ""; }
public function buildRoutes() { $result = []; foreach ($this->routers->map(function (ModelRoute $m) { return $m->getRoutes(); }) as $data) { $result[] = implode("\n", $data); } return implode("\n", $result); }
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(); }
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; }
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; }
private function findEventName(ArrayList $list) { return $list->find(function (Annotation $annotation) { return $annotation->getName() == PluginListener::EVENT_ANNOTATION; })->getArgument(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 ""; }
/** * * @param ArrayList $list * @return Annotation */ private function findTaskAnnotation(ArrayList $list) { return $list->find(function (Annotation $annotation) { return $annotation->getName() == PluginTask::METHOD_ANNOTATION; }); }