/**
  * Returns a list of function/method parameters.
  *
  * @return array
  */
 public function getParameters()
 {
     if (null === $this->parameters) {
         $generator = self::$generator;
         $this->parameters = array_map(function (TokenReflection\IReflectionParameter $parameter) use($generator) {
             return new ReflectionParameter($parameter, $generator);
         }, $this->reflection->getParameters());
         $annotations = $this->getAnnotation('param');
         if (null !== $annotations) {
             foreach ($annotations as $position => $annotation) {
                 if (isset($parameters[$position])) {
                     // Standard parameter
                     continue;
                 }
                 if (!preg_match('~^(?:([\\w\\\\]+(?:\\|[\\w\\\\]+)*)\\s+)?\\$(\\w+),\\.{3}(?:\\s+(.*))?($)~s', $annotation, $matches)) {
                     // Wrong annotation format
                     continue;
                 }
                 list(, $typeHint, $name) = $matches;
                 if (empty($typeHint)) {
                     $typeHint = 'mixed';
                 }
                 $parameter = new ReflectionParameterMagic(null, self::$generator);
                 $parameter->setName($name)->setPosition($position)->setTypeHint($typeHint)->setDefaultValueDefinition(null)->setUnlimited(true)->setPassedByReference(false)->setDeclaringFunction($this);
                 $this->parameters[$position] = $parameter;
             }
         }
     }
     return $this->parameters;
 }
 /**
  * Returns visible magic methods declared by inspected class.
  *
  * @return array
  */
 public function getOwnMagicMethods()
 {
     if (null === $this->ownMagicMethods) {
         $this->ownMagicMethods = array();
         if (!(self::$methodAccessLevels & InternalReflectionMethod::IS_PUBLIC) || false === $this->getDocComment()) {
             return $this->ownMagicMethods;
         }
         $annotations = $this->getAnnotation('method');
         if (null === $annotations) {
             return $this->ownMagicMethods;
         }
         foreach ($annotations as $annotation) {
             if (!preg_match('~^(?:([\\w\\\\]+(?:\\|[\\w\\\\]+)*)\\s+)?(&)?\\s*(\\w+)\\s*\\(\\s*(.*)\\s*\\)\\s*(.*|$)~s', $annotation, $matches)) {
                 // Wrong annotation format
                 continue;
             }
             list(, $returnTypeHint, $returnsReference, $name, $args, $shortDescription) = $matches;
             $doc = $this->getDocComment();
             $tmp = $annotation;
             if ($delimiter = strpos($annotation, "\n")) {
                 $tmp = substr($annotation, 0, $delimiter);
             }
             $startLine = $this->getStartLine() + substr_count(substr($doc, 0, strpos($doc, $tmp)), "\n");
             $endLine = $startLine + substr_count($annotation, "\n");
             $method = new ReflectionMethodMagic(null, self::$generator);
             $method->setName($name)->setShortDescription(str_replace("\n", ' ', $shortDescription))->setStartLine($startLine)->setEndLine($endLine)->setReturnsReference('&' === $returnsReference)->setDeclaringClass($this)->addAnnotation('return', $returnTypeHint);
             $this->ownMagicMethods[$name] = $method;
             $parameters = array();
             foreach (array_filter(preg_split('~\\s*,\\s*~', $args)) as $position => $arg) {
                 if (!preg_match('~^(?:([\\w\\\\]+(?:\\|[\\w\\\\]+)*)\\s+)?(&)?\\s*\\$(\\w+)(?:\\s*=\\s*(.*))?($)~s', $arg, $matches)) {
                     // Wrong annotation format
                     continue;
                 }
                 list(, $typeHint, $passedByReference, $name, $defaultValueDefinition) = $matches;
                 if (empty($typeHint)) {
                     $typeHint = 'mixed';
                 }
                 $parameter = new ReflectionParameterMagic(null, self::$generator);
                 $parameter->setName($name)->setPosition($position)->setTypeHint($typeHint)->setDefaultValueDefinition($defaultValueDefinition)->setUnlimited(false)->setPassedByReference('&' === $passedByReference)->setDeclaringFunction($method);
                 $parameters[$name] = $parameter;
                 $method->addAnnotation('param', ltrim(sprintf('%s $%s', $typeHint, $name)));
             }
             $method->setParameters($parameters);
         }
     }
     return $this->ownMagicMethods;
 }