/** * * @param string|Component $component * @param string $method * @param array $paramters * @return array invoke parameters */ public function getParametersToCall($component, $method, $definitions, $parameters) { $reflectionParameters = Reflection::getReflectionParameters($component, $method); if (isset($definitions['annotations']) && !empty($reflectionParameters)) { $target = Reflection::getReflectionMethod($component, $method); $parameters = $this->requestParameterized($definitions, $target, $reflectionParameters, $parameters); } return $parameters; }
/** * * @param string|object $component * @param string $property * @return \zool\vendor\addendum\ReflectionAnnotatedProperty */ private function getTargetReflection($component, $property) { return Reflection::getReflectionProperty($component, $property); }
/** * Scans for declared components between declared classes. */ private function scanComponents() { $enabledPrefixes = array_merge(self::$APPLICATIONS, array_keys($this->modules)); foreach (get_declared_classes() as $class) { if (Strings::startsWithOneOf($class, $enabledPrefixes)) { $classReflection = new ReflectionAnnotatedClass($class); if (Reflection::inheritFrom($class, self::COMPONENT_PARENT_CLASS)) { if (!$classReflection->hasAnnotation(self::COMPONENT_ANNOTATION)) { $this->log->console("DEFINITION ERROR: {$class} extends Component, but has no annotation 'Component'"); continue; } $componentAnnotation = $classReflection->getAnnotation(self::COMPONENT_ANNOTATION); $componentName = $componentAnnotation->value; $this->log->console("Component: \t {$componentName} -> {$class}"); if (array_key_exists($componentName, $this->components)) { throw new DeploymentException("Multiple component definition: " . $this->components[$componentName]['class'] . " -> " . $class); } $this->components[$componentName] = []; $this->components[$componentName]['class'] = $class; $this->components[$componentName]['annotations'] = []; foreach ($classReflection->getAllAnnotations() as $annot) { $this->components[$componentName]['annotations'][] = $this->exportAnnotation($annot); } $this->components[$componentName]['properties'] = []; $this->components[$componentName]['methods'] = []; foreach ($classReflection->getProperties() as $reflectProp) { $reflectAnnotations = $reflectProp->getAllAnnotations(); if (!empty($reflectAnnotations)) { $this->components[$componentName]['properties'][$reflectProp->name] = []; $this->components[$componentName]['properties'][$reflectProp->name]['annotations'] = []; foreach ($reflectAnnotations as $propAnnot) { $this->components[$componentName]['properties'][$reflectProp->name]['annotations'][] = $this->exportAnnotation($propAnnot); } } } foreach ($classReflection->getMethods() as $reflectMethod) { $this->processMethod($componentName, $reflectMethod); } } } } }