Esempio n. 1
0
 protected function getMethods()
 {
     $methods = $this->reflection->getMethods();
     $classname = $this->reflection->getName();
     if ($this->skip_inherited_attr) {
         $methods = array_filter($methods, function ($prop) use($classname) {
             return $classname == $prop->getDeclaringClassName();
         });
     }
     return array_map(function ($v) {
         return new MethodElement($v);
     }, $methods);
 }
Esempio n. 2
0
 protected function getMethods()
 {
     return array_map(function ($v) {
         return new MethodElement($v);
     }, $this->reflection->getMethods());
 }
Esempio n. 3
0
 /**
  * Returns list of advices from advisor and point filter
  *
  * @param ReflectionClass|ParsedReflectionClass $class Class to inject advices
  * @param Aop\PointcutAdvisor $advisor Advisor for class
  * @param string $advisorId Identifier of advisor
  * @param Aop\PointFilter $filter Filter for points
  *
  * @return array
  */
 private function getAdvicesFromAdvisor($class, Aop\PointcutAdvisor $advisor, $advisorId, Aop\PointFilter $filter)
 {
     $classAdvices = array();
     // Check methods in class only for method filters
     if ($filter->getKind() & Aop\PointFilter::KIND_METHOD) {
         $mask = ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED;
         foreach ($class->getMethods($mask) as $method) {
             /** @var $method ReflectionMethod| */
             if ($filter->matches($method)) {
                 $prefix = $method->isStatic() ? AspectContainer::STATIC_METHOD_PREFIX : AspectContainer::METHOD_PREFIX;
                 $classAdvices[$prefix][$method->name][$advisorId] = $advisor->getAdvice();
             }
         }
     }
     // Check properties in class only for property filters
     if ($filter->getKind() & Aop\PointFilter::KIND_PROPERTY) {
         $mask = ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED;
         foreach ($class->getProperties($mask) as $property) {
             /** @var $property ReflectionProperty */
             if ($filter->matches($property)) {
                 $classAdvices[AspectContainer::PROPERTY_PREFIX][$property->name][$advisorId] = $advisor->getAdvice();
             }
         }
     }
     return $classAdvices;
 }