Ejemplo n.º 1
0
 /**
  * @param \ReflectionMethod[] $methods
  * @param AbstractBean $bean
  * @return array
  */
 private function getAfterCallMethod($methods, AbstractBean $bean)
 {
     $afterCall = [];
     foreach ($methods as $method) {
         $methodName = $method->getName();
         $afterCall[$methodName] = function ($proxy, $instance, $method, $params, $returnValue, &$returnEarly) use($methodName, $bean) {
             $annotationDispatcher = new AnnotationsDispatcher($bean, $bean->getClass(), $bean->getSphringEventDispatcher());
             $params['#result'] = $returnValue;
             $annotationDispatcher->setMethodArgs($params);
             if ($returnValue !== null) {
                 $returnEarly = true;
             }
             $toReturnAfter = $annotationDispatcher->dispatchAnnotationMethodCallAfter($methodName);
             if ($toReturnAfter !== null) {
                 $returnEarly = true;
                 $returnValue = $toReturnAfter;
             }
             return $returnValue;
         };
     }
     return $afterCall;
 }
Ejemplo n.º 2
0
 /**
  *
  */
 protected function instanciate()
 {
     $annotationDispatcher = new AnnotationsDispatcher($this, $this->getClass(), $this->getSphringEventDispatcher());
     $classReflector = new \ReflectionClass($this->class);
     if (empty($this->constructor)) {
         $this->object = $classReflector->newInstance();
         $annotationDispatcher->dispatchAnnotationClassInstantiate();
         return;
     }
     $constructor = $this->constructor;
     if (!empty($this->extend)) {
         $constructor = array_merge($this->extend->getConstructor(), $constructor);
     }
     $this->object = $classReflector->newInstanceArgs($constructor);
     $annotationDispatcher->setMethodArgs($constructor);
     $annotationDispatcher->dispatchAnnotationClassInstantiate();
 }