Author: Mike van Riel (mike.vanriel@naenius.com)
Inheritance: extends ReturnTag
Ejemplo n.º 1
0
 /**
  * Creates a new Descriptor from the given Reflector.
  *
  * @param MethodTag $data
  *
  * @return MethodDescriptor
  */
 public function create($data)
 {
     $descriptor = new MethodDescriptor($data->getName());
     $descriptor->setDescription($data->getDescription());
     $descriptor->setMethodName($data->getMethodName());
     $response = new ReturnDescriptor('return');
     $response->setTypes($this->builder->buildDescriptor(new Collection($data->getTypes())));
     $descriptor->setResponse($response);
     foreach ($data->getArguments() as $argument) {
         $argumentDescriptor = $this->createArgumentDescriptorForMagicMethod($argument);
         $descriptor->getArguments()->set($argumentDescriptor->getName(), $argumentDescriptor);
     }
     return $descriptor;
 }
Ejemplo n.º 2
0
 /**
  * Creates a new Descriptor from the given Reflector.
  *
  * @param MethodTag $data
  *
  * @return MethodDescriptor
  */
 public function create($data)
 {
     $descriptor = new MethodDescriptor($data->getName());
     $descriptor->setDescription($data->getDescription());
     $descriptor->setMethodName($data->getMethodName());
     $response = new ReturnDescriptor('return');
     $response->setTypes($data->getTypes());
     $descriptor->setResponse($response);
     foreach ($data->getArguments() as $argument) {
         if (count($argument) > 1) {
             list($argumentType, $argumentName) = $argument;
         } else {
             $argumentName = current($argument);
             $argumentType = 'mixed';
         }
         $argumentDescriptor = new ArgumentDescriptor();
         $argumentDescriptor->setTypes(array($argumentType));
         $argumentDescriptor->setName($argumentName);
         $descriptor->getArguments()->set($argumentName, $argumentDescriptor);
     }
     return $descriptor;
 }
Ejemplo n.º 3
0
 /**
  * @param DocBlock\Tag\MethodTag $tag
  * @return array
  */
 private function getTypesBy(DocBlock\Tag\MethodTag $tag)
 {
     $types = array();
     $args = $tag->getArguments();
     foreach ($args as $strings) {
         if (count($strings) > 1) {
             foreach ($strings as $string) {
                 $string = trim($string);
                 if (strpos($string, '$') === false && !in_array(strtolower($string), $this->ignoredMethodArgumentTypes)) {
                     $types[] = '\\' . trim($string, '\\');
                 }
             }
         }
     }
     return $types;
 }