Ejemplo n.º 1
0
 public function setReflectionClassFactory(\closure $factory)
 {
     $closure = new \reflectionMethod($factory, '__invoke');
     if ($closure->getNumberOfParameters() != 1) {
         throw new exceptions\logic\invalidArgument('Reflection class factory must take one argument');
     }
     $this->reflectionClassFactory = $factory;
     return $this;
 }
Ejemplo n.º 2
0
 public function setSrcIteratorInjector(\closure $srcIteratorInjector)
 {
     $closure = new \reflectionMethod($srcIteratorInjector, '__invoke');
     if ($closure->getNumberOfParameters() != 1) {
         throw new exceptions\logic('Src iterator injector must take one argument');
     }
     $this->srcIteratorInjector = $srcIteratorInjector;
     return $this;
 }
Ejemplo n.º 3
0
 public function setReflectionClassInjector(\closure $reflectionClassInjector)
 {
     $closure = new \reflectionMethod($reflectionClassInjector, '__invoke');
     if ($closure->getNumberOfParameters() != 1) {
         throw new exceptions\logic\invalidArgument('Reflection class injector must take one argument');
     }
     $this->reflectionClassInjector = $reflectionClassInjector;
     return $this;
 }
Ejemplo n.º 4
0
 public function addHandler(\closure $handler, array $arguments, $priority = 0)
 {
     $invoke = new \reflectionMethod($handler, '__invoke');
     if ($invoke->getNumberOfParameters() < 3) {
         throw new exceptions\runtime('Handler must take three arguments');
     }
     foreach ($arguments as $argument) {
         if (self::isArgument($argument) === false) {
             throw new exceptions\runtime('Argument \'' . $argument . '\' is invalid');
         }
         $this->handlers[$argument][] = $handler;
         $this->priorities[$argument] = (int) $priority;
     }
     return $this;
 }