当前位置: 首页>>代码示例>>PHP>>正文


PHP DocBlockGenerator::setLongDescription方法代码示例

本文整理汇总了PHP中Zend\Code\Generator\DocBlockGenerator::setLongDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP DocBlockGenerator::setLongDescription方法的具体用法?PHP DocBlockGenerator::setLongDescription怎么用?PHP DocBlockGenerator::setLongDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Code\Generator\DocBlockGenerator的用法示例。


在下文中一共展示了DocBlockGenerator::setLongDescription方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGenerateWithWordWrapDisabled

 /**
  * @group #3753
  */
 public function testGenerateWithWordWrapDisabled()
 {
     $largeStr = '@var This is a very large string that will not be wrapped if it contains more than 80 characters';
     $this->docBlockGenerator->setLongDescription($largeStr);
     $this->docBlockGenerator->setWordWrap(false);
     $expected = '/**' . DocBlockGenerator::LINE_FEED . ' * @var This is a very large string that will not be wrapped if it contains more than' . ' 80 characters' . DocBlockGenerator::LINE_FEED . ' */' . DocBlockGenerator::LINE_FEED;
     $this->assertEquals($expected, $this->docBlockGenerator->generate());
 }
开发者ID:rajanlamic,项目名称:IntTest,代码行数:11,代码来源:DocBlockGeneratorTest.php

示例2: generate

 public function generate(Generator\ClassGenerator $class, PHPClass $type)
 {
     $class = $this->fixInterfaces($class);
     if (!($extends = $type->getExtends()) && class_exists($type->getNamespace())) {
         $extendNamespace = $type->getNamespace();
         $extendNamespace = explode('\\', $extendNamespace);
         $extendClass = array_pop($extendNamespace);
         $extendNamespace = implode('\\', $extendNamespace);
         $extends = new PHPClass();
         $extends->setName($extendClass);
         $extends->setNamespace($extendNamespace);
         $class->setExtendedClass($extends);
     }
     if ($type->getNamespace() == Enumeration::class) {
         $extendNamespace = $type->getNamespace();
         $extendNamespace = explode('\\', $extendNamespace);
         $extendClass = array_pop($extendNamespace);
         $extendNamespace = implode('\\', $extendNamespace);
         $extends = new PHPClass();
         $extends->setName($extendClass);
         $extends->setNamespace($extendNamespace);
         $class->setExtendedClass($extends);
     }
     if ($extends->getName() == "string" && $extends->getNamespace() == "" && class_exists($type->getNamespace() . '\\String')) {
         $extends->setName('String');
         $extends->setNamespace($type->getNamespace());
     } elseif ($extends->getName() == "string" && $extends->getNamespace() == "" && class_exists($type->getNamespace())) {
         $extendNamespace = $type->getNamespace();
         $extendNamespace = explode('\\', $extendNamespace);
         $extendClass = array_pop($extendNamespace);
         $extendNamespace = implode('\\', $extendNamespace);
         $extends = new PHPClass();
         $extends->setName($extendClass);
         $extends->setNamespace($extendNamespace);
         $class->setExtendedClass($extends);
     }
     $docblock = new DocBlockGenerator("Class representing " . $type->getName());
     if ($type->getDoc()) {
         $docblock->setLongDescription($type->getDoc());
     }
     $class->setNamespaceName($type->getNamespace());
     $class->setName($type->getName());
     $class->setDocblock($docblock);
     $class->setExtendedClass($extends->getName());
     if ($extends->getNamespace() != $type->getNamespace()) {
         if ($extends->getName() == $type->getName()) {
             $class->addUse($type->getExtends()->getFullName(), $extends->getName() . "Base");
             $class->setExtendedClass($extends->getName() . "Base");
         } else {
             $class->addUse($extends->getFullName());
         }
     }
     if ($this->handleBody($class, $type)) {
         return true;
     }
 }
开发者ID:garethp,项目名称:php-ews,代码行数:56,代码来源:ClassGenerator.php

示例3: addAttribute

 /**
  * @param ClassGenerator $class
  * @param Attribute $tagAttribute
  */
 protected function addAttribute(ClassGenerator $class, Attribute $tagAttribute)
 {
     $methodName = str_replace(':', '-', $tagAttribute->getName());
     $methodName = ucfirst($this->stringToCamelCaseConverter->convert($methodName, '-'));
     $method = new MethodGenerator();
     if ($tagAttribute->isFlag()) {
         $method->setName('is' . $methodName);
         $method->setParameter(new ParameterGenerator('v', 'bool', true));
     } else {
         $method->setName('set' . $methodName);
         $method->setParameter(new ParameterGenerator('v', 'string'));
     }
     $body = [];
     $body[] = '$this->attributes[\'' . $tagAttribute->getName() . '\'] = $v;';
     $body[] = 'return $this;';
     $method->setBody(implode(PHP_EOL, $body));
     $docBlock = new DocBlockGenerator();
     $docBlock->setTag(new GenericTag('var', 'string'));
     $docBlock->setTag(new GenericTag('return', '$this'));
     if (!is_null($tagAttribute->getDescription())) {
         $docBlock->setLongDescription($tagAttribute->getDescription());
     }
     $method->setDocBlock($docBlock);
     $class->addMethodFromGenerator($method);
 }
开发者ID:elnebuloso,项目名称:flex-code-html,代码行数:29,代码来源:Generator.php

示例4: generate

 public function generate()
 {
     $method = $this->getMethodGenerator();
     $api = $this->getApi();
     $operation = $this->getOperation();
     $method->setName($operation->getNickname());
     $parameterClassGenerator = $this->getParameterClassGenerator();
     $parameterClassGenerator->setName($operation->getNickname());
     $parameterGenerator = $this->getParameterGenerator();
     $propertyGenerator = $this->getPropertyGenerator();
     $docBlockGenerator = $this->getDocblockGenerator();
     $docBlockGenerator->setShortDescription($operation->getSummary());
     $docBlockGenerator->setLongDescription(strip_tags($operation->getNotes()));
     $hasRequired = false;
     $routeParams = array();
     foreach ($operation->getParameters() as $swaggerParameter) {
         switch ($swaggerParameter->getParamType()) {
             case self::PARAM_TYPE_PATH:
                 if ($swaggerParameter->getRequired()) {
                     $hasRequired = true;
                 }
                 $parameters = $method->getParameters();
                 if (isset($parameters[$swaggerParameter->getName()])) {
                     continue;
                 }
                 $parameter = clone $parameterGenerator;
                 $parameter->setName($swaggerParameter->getName());
                 $method->setParameter($parameter);
                 $paramTag = new CodeGenerator\DocBlock\Tag\ParamTag();
                 $paramTag->setDataType($swaggerParameter::getType($swaggerParameter->getDataType()));
                 $paramTag->setParamName($swaggerParameter->getName());
                 $paramDescription = $swaggerParameter->getDescription();
                 $paramTag->setDescription($paramDescription);
                 $docBlockGenerator->setTag($paramTag);
                 $routeParams[] = $parameter;
                 break;
             case self::PARAM_TYPE_QUERY:
             case self::PARAM_TYPE_FORM:
                 $propertyName = lcfirst($swaggerParameter->getName());
                 if (($postParamStart = strpos($propertyName, '[')) !== false) {
                     $propertyPostParams = substr($propertyName, $postParamStart);
                     $propertyName = substr($propertyName, 0, $postParamStart);
                     echo "{$method->getName()}::\${$propertyName} has: {$propertyPostParams}" . PHP_EOL;
                 }
                 if ($parameterClassGenerator->hasProperty($propertyName)) {
                     continue;
                 }
                 $property = clone $propertyGenerator;
                 $property->setName($propertyName);
                 $propertyDocblock = new CodeGenerator\DocBlockGenerator();
                 $propertyDocblock->setShortDescription($swaggerParameter->getDescription());
                 $propertyDescription = '';
                 if ($allowableValues = $swaggerParameter->getAllowableValues()) {
                     if ($allowableValues->getValueType() == 'LIST') {
                         $propertyDescription .= 'Allowable values: [' . implode(', ', $allowableValues->getValues()) . ']' . PHP_EOL;
                     }
                 }
                 $propertyDocblock->setLongDescription($propertyDescription);
                 if (!$this->isDocBlockEmpty($propertyDocblock)) {
                     $property->setDocBlock($propertyDocblock);
                 }
                 $parameterClassGenerator->addPropertyFromGenerator($property);
                 $getterGenerator = $this->generateParameterGetter($propertyName, $swaggerParameter);
                 $setterGenerator = $this->generateParameterSetter($propertyName, $swaggerParameter);
                 $parameterClassGenerator->addMethods(array($getterGenerator, $setterGenerator));
                 break;
         }
     }
     if (count($parameterClassGenerator->getProperties())) {
         $queryParameter = clone $parameterGenerator;
         $queryParameter->setName($operation->getNickname());
         $queryParameter->setType(RestGenerator::REQUEST_NAMESPACE_ALIAS . '\\' . $operation->getNickname());
         if (!$hasRequired) {
             $queryParameter->setDefaultValue(new CodeGenerator\ValueGenerator(null));
         }
         $paramTag = new CodeGenerator\DocBlock\Tag\ParamTag();
         $paramTag->setDataType(RestGenerator::REQUEST_NAMESPACE_ALIAS . '\\' . $operation->getNickname());
         $paramTag->setParamName($operation->getNickname());
         if (!$hasRequired) {
             $paramTag->setDescription(' = null');
         }
         $docBlockGenerator->setTag($paramTag);
         $method->setParameter($queryParameter);
     } else {
         $queryParameter = null;
     }
     $method->setDocBlock($docBlockGenerator);
     $body = $this->getBody($routeParams, $queryParameter);
     $method->setBody($body);
 }
开发者ID:vmalinovskiy,项目名称:CallFire-PHP-SDK,代码行数:90,代码来源:Action.php

示例5: generate

 public function generate(Generator\ClassGenerator $class, PHPClass $type)
 {
     $docblock = new DocBlockGenerator("Class representing " . $type->getName());
     if ($type->getDoc()) {
         $docblock->setLongDescription($type->getDoc());
     }
     $class->setNamespaceName($type->getNamespace() ?: NULL);
     $class->setName($type->getName());
     $class->setDocblock($docblock);
     if ($extends = $type->getExtends()) {
         if ($p = $this->isOneType($extends)) {
             $this->handleProperty($class, $p);
             $this->handleValueMethod($class, $p, $extends);
         } else {
             $class->setExtendedClass($extends->getName());
             if ($extends->getNamespace() != $type->getNamespace()) {
                 if ($extends->getName() == $type->getName()) {
                     $class->addUse($type->getExtends()->getFullName(), $extends->getName() . "Base");
                     $class->setExtendedClass($extends->getName() . "Base");
                 } else {
                     $class->addUse($extends->getFullName());
                 }
             }
         }
     }
     if ($this->handleBody($class, $type)) {
         return true;
     }
 }
开发者ID:josedasilva,项目名称:xsd2php,代码行数:29,代码来源:ClassGenerator.php

示例6: testLongDescriptionGetterAndSetter

 public function testLongDescriptionGetterAndSetter()
 {
     $this->docBlockGenerator->setLongDescription('Long Description');
     $this->assertEquals('Long Description', $this->docBlockGenerator->getLongDescription());
 }
开发者ID:haoyanfei,项目名称:zf2,代码行数:5,代码来源:DocBlockGeneratorTest.php


注:本文中的Zend\Code\Generator\DocBlockGenerator::setLongDescription方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。