Ejemplo n.º 1
0
 /**
  * Build a two-dimensional array containing the contents of the method
  * annotations discovered in the document comment.
  * The format of the returned array is compatible with the generate
  * wsdl function
  *      array( 'parameters' => $parameter_descriptions,
  *             'return'     => $return_descriptor
  *        );
  *
  * @return array ( 2dim array containing parameter lines or null )
  * @throws SCA_RuntimeException when an error in the parameter annotation
  */
 public function getMethodAnnotations()
 {
     $i = 0;
     $this->reason = null;
     $this->annotation = array();
     $this->methodAnnotations = SCA_AnnotationRules::createEmptyAnnotationArray();
     $line = strtok($this->docComment, self::EOL);
     /* 1st line              */
     /* Loop round until all the doc comment has been read                  */
     while ($line !== false) {
         /* Is this a 'parameter' line                                      */
         if ($this->Rule->isMethodAnnotation($line)) {
             /* Extract the components of the annotation into an array      */
             $words = SCA_AnnotationRules::parseAnnotation($line);
             if (SCA_AnnotationRules::enoughPieces($words) !== true) {
                 $reason = "Invalid method annotation syntax in '{$line}' ";
                 throw new SCA_RuntimeException($reason);
             }
             if (strcmp($words[0], SCA_AnnotationRules::PARAM) === 0) {
                 $this->methodAnnotations[self::PARAM_ANNOTATION][$i++] = $this->setParameterValues($words);
             } else {
                 if (strcmp($words[0], SCA_AnnotationRules::NAME) === 0) {
                     $this->methodAnnotations[self::NAME_ANNOTATION] = $this->setMethodAlias($words);
                 } else {
                     /* Ensure that no syntax error has been detected       */
                     if (($checkValue = $this->setReturnValues($words)) != null) {
                         $this->methodAnnotations[self::RETRN_ANNOTATION][0] = $checkValue;
                     } else {
                         $reason = "Invalid return annotation syntax in '{$line}' ";
                         throw new SCA_RuntimeException($reason);
                     }
                 }
             }
         }
         $line = strtok(self::EOL);
         /* next line                            */
     }
     return $this->methodAnnotations;
 }