Exemplo n.º 1
0
 protected static function getParameters(\reflectionFunction $function)
 {
     $parameters = array();
     foreach ($function->getParameters() as $parameter) {
         $parameters[] = ($parameter->isPassedByReference() === false ? '' : '& ') . '$' . $parameter->getName();
     }
     return 'array(' . join(',', $parameters) . ')';
 }
Exemplo n.º 2
0
 public function setDefaultHandler(\closure $handler)
 {
     $reflectedHandler = new \reflectionFunction($handler);
     if ($reflectedHandler->getNumberOfParameters() < 2) {
         throw new exceptions\runtime('Handler must take two arguments');
     }
     $this->defaultHandler = $handler;
     return $this;
 }
Exemplo n.º 3
0
 private static function filterParameters(\reflectionFunction $function)
 {
     return array_filter($function->getParameters(), function ($parameter) {
         return $parameter->getName() != '...';
     });
 }
Exemplo n.º 4
0
 protected static function isBindable(\closure $closure)
 {
     $isBindable = version_compare(PHP_VERSION, '5.4.0') >= 0;
     if ($isBindable === true) {
         $reflectedClosure = new \reflectionFunction($closure);
         $isBindable = $reflectedClosure->getClosureThis() !== null || $reflectedClosure->getClosureScopeClass() === null;
     }
     return $isBindable;
 }