private function isValidMethod(MethodReflector $method)
 {
     if ($method->isMagic()) {
         return false;
     }
     if (!$method->isPublic()) {
         return false;
     }
     return true;
 }
 public function testParameterMapping()
 {
     $method = new MethodReflector('Test\\Provider\\Reflection\\Mapping', 'someMethod');
     try {
         $result = $method->mergeNamedArgs(array('id' => 1, 'name' => 'Name'));
     } catch (Exception $e) {
         $this->assert(false, "The parameters couldn't be merged.");
     }
     $this->assert($result[0] === 1 && $result[1] === 'Name' && $result[2] === true, 'The parameters were not merged properly');
 }
 private function isValidMethod(MethodReflector $method)
 {
     if ($method->getName() === 'bootstrap') {
         return false;
     }
     if ($method->isMagic()) {
         return false;
     }
     if (!$method->isPublic()) {
         return false;
     }
     return true;
 }
Beispiel #4
0
 public function __invoke(ControllerAbstract $controller, ClassReflector $class, MethodReflector $method, array &$context)
 {
     foreach ($method->getParameters() as $param) {
         if (!($type = $param->getClass())) {
             continue;
         }
         $type = $type->getName();
         $name = $param->getName();
         if (isset($context[$name])) {
             $value = $context[$name];
         } elseif ($param->isDefaultValueAvailable()) {
             $value = $param->getDefaultValue();
         } else {
             Exception::toss('Cannot type-hint "%s" in "%s" because the request does not contain the parameter and a default value was not specified.', $name, $method->__toString());
         }
         $context[$name] = new $type($value);
     }
 }
 private function applyTypes(ContainerInterface $container, MethodReflector $method)
 {
     if ($method->getDocBlock()->hasTag(self::DOC_TAG_RETURN)) {
         $container->setTypes($method->getName(), $method->getDocBlock()->getTag(self::DOC_TAG_RETURN)->getTypes());
     }
 }
Beispiel #6
0
 private function formatScript(Reflection\MethodReflector $method)
 {
     return $this->formatClass($method->getClass()) . '/' . $this->formatMethod($method);
 }