예제 #1
0
 public function all(Specification $spec = null)
 {
     if ($spec === null) {
         $spec = new Specification();
     }
     $methods = [];
     foreach ($this->methods as $method) {
         if ($spec->satisfy($method)) {
             $methods[$method->name] = $method;
         }
     }
     $parentSpec = new Specification($spec->getParentMode(), $spec->isStatic(), $spec->isMagic());
     if ($this->class instanceof ClassData) {
         $parent = $this->class->getParent();
         if ($parent instanceof ClassData) {
             $parentM = $parent->methods->all($parentSpec);
             $methods = array_merge($parentM, $methods);
         }
     }
     foreach ($this->class->getInterfaces() as $interface) {
         if ($interface instanceof InterfaceData) {
             $parentM = $interface->methods->all($parentSpec);
             $methods = array_merge($parentM, $methods);
         }
     }
     return $methods;
 }
예제 #2
0
 public function get($propName, Specification $spec = null)
 {
     if ($spec === null) {
         $spec = new Specification('private', 2, false);
     }
     if (array_key_exists($propName, $this->map)) {
         $prop = $this->map[$propName];
         if ($spec->satisfy($prop)) {
             return $prop;
         }
         return null;
     }
     $parent = $this->class->getParent();
     if ($parent instanceof ClassData) {
         return $parent->properties->get($propName, new Specification($spec->getParentMode(), $spec->isStatic(), $spec->isMagic()));
     }
 }