Пример #1
0
 /**
  * @param PhpMethod $method
  * @return PhpAnnotationBlock
  */
 protected function getStructMethodsSetAndGetAnnotationBlock(PhpMethod $method)
 {
     $parameters = $method->getParameters();
     $setOrGet = strtolower(substr($method->getName(), 0, 3));
     $parameter = array_shift($parameters);
     /**
      * Only set parameter must be based on a potential PhpFunctionParameter
      */
     if ($parameter instanceof PhpFunctionParameter && $setOrGet === 'set') {
         $parameterName = ucfirst($parameter->getName());
     } else {
         $parameterName = substr($method->getName(), 3);
     }
     $attribute = $this->getModel()->getAttribute($parameterName);
     if (!$attribute instanceof StructAttributeModel) {
         $parameterName = lcfirst($parameterName);
         $attribute = $this->getModel()->getAttribute($parameterName);
     }
     $setValueAnnotation = '%s %s value';
     $annotationBlock = new PhpAnnotationBlock();
     if ($attribute instanceof StructAttributeModel) {
         $annotationBlock->addChild(sprintf($setValueAnnotation, ucfirst($setOrGet), $parameterName));
         $this->addStructMethodsSetAndGetAnnotationBlockFromStructAttribute($setOrGet, $annotationBlock, $attribute);
     } elseif (empty($attribute)) {
         $annotationBlock->addChild(sprintf($setValueAnnotation, ucfirst($setOrGet), lcfirst($parameterName)));
         $this->addStructMethodsSetAndGetAnnotationBlockFromScalar($setOrGet, $annotationBlock, $parameterName);
     }
     return $annotationBlock;
 }
Пример #2
0
 /**
  * @param PhpAnnotationBlock $annotationBlock
  * @param PhpMethod $method
  * @return Service
  */
 protected function addAnnotationBlockForSoapHeaderMethod(PhpAnnotationBlock $annotationBlock, PhpMethod $method)
 {
     $methodParameters = $method->getParameters();
     $firstParameter = array_shift($methodParameters);
     if ($firstParameter instanceof PhpFunctionParameter) {
         $annotationBlock->addChild(sprintf('Sets the %s SoapHeader param', ucfirst($firstParameter->getName())))->addChild(new PhpAnnotation(self::ANNOTATION_USES, sprintf('%s::setSoapHeader()', $this->getModel()->getExtends(true))))->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, sprintf('%s $%s', $firstParameter->getType(), $firstParameter->getName())))->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, sprintf('string $%s', self::PARAM_SET_HEADER_NAMESPACE)))->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, sprintf('bool $%s', self::PARAM_SET_HEADER_MUSTUNDERSTAND)))->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, sprintf('string $%s', self::PARAM_SET_HEADER_ACTOR)))->addChild(new PhpAnnotation(self::ANNOTATION_RETURN, 'bool'));
     }
     return $this;
 }
Пример #3
0
 /**
  * @param PhpMethod $method
  * @return string
  */
 protected function getOperationCallParameters(PhpMethod $method)
 {
     $parameters = array();
     foreach ($method->getParameters() as $parameter) {
         if ($parameter instanceof PhpFunctionParameter) {
             $parameters[] = $this->getOperationCallParameterName($parameter, $method);
         }
     }
     return sprintf('%s%s', implode($this->getOperationCallParametersSeparator(), $parameters), $this->getOperationCallParametersEnding());
 }