/** * Constructor for method invocation * * @param string $className Class name * @param string $methodName Method to invoke * @param $advices array List of advices for this invocation */ public function __construct($className, $methodName, array $advices) { parent::__construct($advices); $this->className = $className; $this->reflectionMethod = $method = new AnnotatedReflectionMethod($this->className, $methodName); // Give an access to call protected method if ($method->isProtected()) { $method->setAccessible(true); } }
/** * Constructor for constructor invocation :) * * @param string $className Class name * @param $advices array List of advices for this invocation */ public function __construct($className, $type, array $advices) { $this->class = new ReflectionClass($className); $this->constructor = $constructor = $this->class->getConstructor(); // Give an access to call protected constructor if ($constructor && $constructor->isProtected()) { $constructor->setAccessible(true); } if ($constructor) { $this->constructorArguments = $constructor->getNumberOfParameters(); } parent::__construct($advices); }
/** * Constructor for function invocation * * @param string $functionName Function to invoke * @param $advices array List of advices for this invocation */ public function __construct($functionName, array $advices) { parent::__construct($advices); $this->reflectionFunction = new ReflectionFunction($functionName); }
/** * Constructor for constructor invocation :) * * @param string $className Class name * @param $advices array List of advices for this invocation */ public function __construct($className, array $advices) { $this->class = new ReflectionClass($className); parent::__construct($advices); }