コード例 #1
0
ファイル: Utils.php プロジェクト: wsdltophp/packagegenerator
 /**
  * @param PhpAnnotationBlock $block
  * @param AbstractModel $model
  * @param array $ignoreMeta
  * @return AbstractModelFile
  */
 public static function defineModelAnnotationsFromWsdl(PhpAnnotationBlock $block, AbstractModel $model, array $ignoreMeta = array())
 {
     $validMeta = self::getValidMetaValues($model, $ignoreMeta);
     if (!empty($validMeta)) {
         /**
          * First line is the "The {propertyName}"
          */
         if (count($block->getChildren()) === 1) {
             $block->addChild('Meta informations extracted from the WSDL');
         }
         foreach ($validMeta as $meta) {
             $block->addChild(new PhpAnnotation(PhpAnnotation::NO_NAME, $meta, AbstractModelFile::ANNOTATION_LONG_LENGTH));
         }
     }
 }
コード例 #2
0
 /**
  * @param PhpAnnotationBlock $block
  * @param string $content
  * @return Tutorial
  */
 public function addChild(PhpAnnotationBlock $block, $content)
 {
     $block->addChild(new PhpAnnotation(PhpAnnotation::NO_NAME, $content, AbstractModelFile::ANNOTATION_LONG_LENGTH));
     return $this;
 }
コード例 #3
0
ファイル: Service.php プロジェクト: jzaeske/PackageGenerator
 /**
  * @param PhpAnnotationBlock $annotationBlock
  * @return Service
  */
 protected function addAnnnotationBlockForgetResultMethod(PhpAnnotationBlock $annotationBlock)
 {
     $annotationBlock->addChild('Returns the result')->addChild(new PhpAnnotation(self::ANNOTATION_SEE, sprintf('%s::getResult()', $this->getModel()->getExtends(true))))->addChild(new PhpAnnotation(self::ANNOTATION_RETURN, $this->getServiceReturnTypes(), self::ANNOTATION_LONG_LENGTH));
     return $this;
 }
コード例 #4
0
 /**
  * @param string $name
  * @param string $description
  * @param string $param
  * @return PhpAnnotationBlock
  */
 protected function getArrayMethodGenericAnnotationBlock($name, $description, $param = null)
 {
     $annotationBlock = new PhpAnnotationBlock(array($description, new PhpAnnotation(self::ANNOTATION_SEE, sprintf('%s::%s()', $this->getModel()->getExtends(true), $name))));
     if (!empty($param)) {
         $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, $param));
     }
     $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_RETURN, $this->getStructAttributeTypeGetAnnotation(null, false)));
     return $annotationBlock;
 }
コード例 #5
0
 /**
  * @param PhpAnnotationBlock $block
  * @return AbstractModelFile
  */
 protected function defineModelAnnotationsFromInheritance(PhpAnnotationBlock $block)
 {
     $struct = $this->getGenerator()->getStruct($this->getModel()->getInheritance());
     if ($struct instanceof StructModel && $struct->getIsStruct() === false) {
         $validMeta = $this->getValidMetaValues($struct);
         foreach ($validMeta as $meta) {
             $block->addChild($meta);
         }
     }
     return $this;
 }
コード例 #6
0
 public function testAddChildContentOk()
 {
     $annotationBlock = new PhpAnnotationBlock();
     $annotationBlock->addChild(array('content' => 'The content', 'name' => 'name'));
     $this->assertCount(1, $annotationBlock->getChildren());
 }
コード例 #7
0
ファイル: Struct.php プロジェクト: wsdltophp/packagegenerator
 /**
  * @param PhpMethod $method
  * @return PhpAnnotationBlock
  */
 protected function getStructMethodsAddToAnnotationBlock(PhpMethod $method)
 {
     $attributeName = str_replace('addTo', '', $method->getName());
     $attribute = $this->getModel()->getAttribute($attributeName);
     if (!$attribute instanceof StructAttributeModel) {
         $attribute = $this->getModel()->getAttribute(lcfirst($attributeName));
     }
     $model = $this->getRestrictionFromStructAttribute($attribute);
     $annotationBlock = new PhpAnnotationBlock();
     if ($attribute instanceof StructAttributeModel) {
         $annotationBlock->addChild(sprintf('Add item to %s value', $attribute->getCleanName()));
         if ($model instanceof StructModel) {
             $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_USES, sprintf('%s::%s()', $model->getPackagedName(true), StructEnum::METHOD_VALUE_IS_VALID)))->addChild(new PhpAnnotation(self::ANNOTATION_USES, sprintf('%s::%s()', $model->getPackagedName(true), StructEnum::METHOD_GET_VALID_VALUES)));
         }
         $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_THROWS, '\\InvalidArgumentException'))->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, sprintf('%s $item', $this->getStructAttributeTypeSetAnnotation($attribute, false))))->addChild(new PhpAnnotation(self::ANNOTATION_RETURN, $this->getModel()->getPackagedName(true)));
     }
     return $annotationBlock;
 }
コード例 #8
0
 /**
  * @param PhpAnnotationBlock $annotationBlock
  * @return OperationAnnotationBlock
  */
 protected function addOperationMethodReturn(PhpAnnotationBlock $annotationBlock)
 {
     $annotationBlock->addChild(new PhpAnnotation(AbstractModelFile::ANNOTATION_RETURN, sprintf('%s|bool', $this->getOperationMethodReturnType($this->getMethod()))));
     return $this;
 }
コード例 #9
0
 /**
  * @return PhpAnnotationBlock
  */
 protected function getEnumGetValidValuesAnnotationBlock()
 {
     $annotationBlock = new PhpAnnotationBlock(array('Return allowed values'));
     foreach ($this->getEnumMethodValues() as $value) {
         $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_USES, $value));
     }
     $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_RETURN, 'string[]'));
     return $annotationBlock;
 }
コード例 #10
0
 /**
  * @return PhpAnnotationBlock
  */
 protected function getClassAnnotationBlock()
 {
     $block = new PhpAnnotationBlock();
     $block->addChild($this->getClassDeclarationLine());
     $this->defineModelAnnotationsFromWsdl($block)->definePackageAnnotations($block)->defineGeneralAnnotations($block);
     return $block;
 }