/**
  * {@inheritdoc}
  * @throws MethodDefinitionAlreadyExistsException
  * @throws MethodDefinitionNotFoundException
  */
 public function analyze(DefinitionAnalyzer $analyzer, ClassDefinition $classDefinition, \ReflectionMethod $reflectionMethod)
 {
     $methodName = $reflectionMethod->getName();
     // Constructor definition is required
     if ($methodName === '__construct' && !$classDefinition->hasMethod('__construct')) {
         $classDefinition->defineConstructor()->end();
     }
     // Set method metadata
     if ($classDefinition->hasMethod($methodName)) {
         $classDefinition->getMethod($methodName)->setModifiers($reflectionMethod->getModifiers())->setIsPublic($reflectionMethod->isPublic());
     }
 }
 /**
  * {@inheritdoc}
  * @throws ParameterDefinitionAlreadyExistsException
  * @throws ReferenceNotImplementsException
  * @throws MethodDefinitionNotFoundException
  * @throws ParameterDefinitionNotFoundException
  * @throws \InvalidArgumentException
  */
 public function analyze(DefinitionAnalyzer $analyzer, ClassDefinition $classDefinition, \ReflectionParameter $reflectionParameter)
 {
     $methodName = $reflectionParameter->getDeclaringFunction()->getName();
     $parameterName = $reflectionParameter->getName();
     // Define parameter only if method definition is available
     if ($classDefinition->hasMethod($methodName)) {
         $methodDefinition = $classDefinition->getMethod($methodName);
         // Define parameter definition if not exists
         $parameterDefinition = $methodDefinition->setupParameter($parameterName);
         $this->setReflectionMetadata($parameterDefinition, $reflectionParameter);
         $dependency = $parameterDefinition->getDependency();
         // If dependency was not set
         // UndefinedReference is the default value of dependency which was not use before
         if (!$dependency || $dependency instanceof UndefinedReference) {
             $this->setDependencyByReflection($parameterDefinition, $reflectionParameter);
         }
         $this->setOrderArguments($methodDefinition, $reflectionParameter->getDeclaringFunction());
     }
 }
 /**
  * {@inheritdoc}
  * @throws MethodDefinitionAlreadyExistsException
  */
 public function analyze(DefinitionAnalyzer $analyzer, ClassDefinition $classDefinition, \ReflectionMethod $reflectionMethod)
 {
     $methodName = $reflectionMethod->getName();
     // Resolve annotations
     $annotations = $this->reader->getMethodAnnotations($reflectionMethod);
     // Create method definition if annotation is exists
     if (count($annotations)) {
         // Define method if not exists
         if (!$classDefinition->hasMethod($methodName)) {
             $classDefinition->defineMethod($methodName);
         }
         // Exec method annotations
         foreach ($annotations as $annotation) {
             if ($annotation instanceof ResolveMethodInterface) {
                 $annotation->resolveMethod($analyzer, $classDefinition, $reflectionMethod);
             }
         }
     }
 }