/** * Processes reflection method. * * @param string $componentName name of component * @param ReflectionProperty $reflectMethod reflection method * * @return void */ private function processMethod($componentName, $reflectMethod) { $reflectAnnotationsList = $reflectMethod->getAllAnnotations(); if ($reflectMethod->isPublic() && !empty($reflectAnnotationsList)) { foreach ($reflectAnnotationsList as $methodAnnot) { $annotationClass = get_class($methodAnnot); if ($annotationClass == self::OBSERVER_ANNOTATION) { $eventName = $methodAnnot->value; $this->addEventListener($eventName, ['component' => $componentName, 'method' => $reflectMethod->getName(), 'static' => $reflectMethod->isStatic()], $methodAnnot->priority); } elseif ($annotationClass == self::FACTORY_ANNOTATION) { $this->addFactory($methodAnnot->value, ['component' => $componentName, 'method' => $reflectMethod->getName(), 'static' => $reflectMethod->isStatic(), 'scope' => $methodAnnot->scope]); } else { if (!isset($this->components[$componentName]['methods'][$reflectMethod->name]) || !isset($this->components[$componentName]['methods'][$reflectMethod->name]['annotations'])) { $this->components[$componentName]['methods'][$reflectMethod->name] = []; $this->components[$componentName]['methods'][$reflectMethod->name]['annotations'] = []; } $this->components[$componentName]['methods'][$reflectMethod->name]['annotations'][] = $this->exportAnnotation($methodAnnot); } } } }