Esempio n. 1
0
 /**
  * Parse the lines for this tag into the Doc data container
  * @param zibo\api\model\doc\Doc $doc Doc data container
  * @param array $lines doc comment lines for this tag
  * @return null
  */
 public function parse(Doc $doc, array $lines)
 {
     $param = implode("\n", $lines);
     $positionSpace = strpos($param, ' ');
     if ($positionSpace === false) {
         $type = $param;
         $name = null;
         $description = null;
     } else {
         $type = substr($param, 0, $positionSpace);
         $positionDescription = strpos($param, ' ', $positionSpace + 1);
         if ($positionDescription === false) {
             $name = substr($param, $positionSpace + 1);
             $description = null;
         } else {
             $positionName = $positionSpace + 1;
             $name = substr($param, $positionName, $positionDescription - $positionName);
             $description = substr($param, $positionDescription + 1);
         }
         if ($name && $name[0] != '$') {
             $description = $name . ($description ? ' ' . $description : '');
             $name = null;
         }
     }
     $parameter = new DocParameter();
     $parameter->setType($type);
     $parameter->setName($name);
     $parameter->setDescription($description);
     $doc->addParameter($parameter);
 }
Esempio n. 2
0
 /**
  * Parse the lines for this tag into the Doc data container
  * @param zibo\api\model\doc\Doc $doc Doc data container
  * @param array $lines doc comment lines for this tag
  * @return null
  */
 public function parse(Doc $doc, array $lines)
 {
     $exception = implode("\n", $lines);
     $positionSpace = strpos($exception, ' ');
     if ($positionSpace === false) {
         $type = $exception;
         $description = null;
     } else {
         $type = substr($exception, 0, $positionSpace);
         $description = substr($exception, $positionSpace + 1);
     }
     $exception = new DocParameter();
     $exception->setType($type);
     $exception->setDescription($description);
     $doc->addException($exception);
 }
Esempio n. 3
0
 /**
  * Parse the lines for this tag into the Doc data container
  * @param zibo\api\model\doc\Doc $doc Doc data container
  * @param array $lines doc comment lines for this tag
  * @return null
  */
 public function parse(Doc $doc, array $lines)
 {
     $return = implode("\n", $lines);
     $positionSpace = strpos($return, ' ');
     if ($positionSpace === false) {
         $type = trim($return);
         $description = null;
     } else {
         $type = substr($return, 0, $positionSpace);
         $description = trim(substr($return, $positionSpace));
     }
     if ($type == 'null' && !$description) {
         return;
     }
     $parameter = new DocParameter();
     $parameter->setType($type);
     $parameter->setDescription($description);
     $doc->setReturn($parameter);
 }
Esempio n. 4
0
 /**
  * Add a parameter of the documented method
  * @param DocParameter $parameter definition of the parameter
  * @return null
  */
 public function addParameter(DocParameter $parameter)
 {
     $this->parameters[$parameter->getName()] = $parameter;
 }