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


PHP DocBlock::getShortDescription方法代码示例

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


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

示例1: addDescription

 /**
  * Adds the short description of $docblock to the given node as description
  * field.
  *
  * @param \DOMElement $node
  * @param DocBlock $docblock
  *
  * @return void
  */
 protected function addDescription(\DOMElement $node, DocBlock $docblock)
 {
     $cdata = $node->ownerDocument->createCDATASection($docblock->getShortDescription());
     $description = new \DOMElement('description');
     $node->appendChild($description);
     $description->appendChild($cdata);
 }
开发者ID:rmoorman,项目名称:phpDocumentor2,代码行数:16,代码来源:DocBlockExporter.php

示例2: configure

 protected function configure()
 {
     $reflection = new \ReflectionClass(get_called_class());
     $baseNamespaceChunks = [];
     foreach (explode('\\', $reflection->getNamespaceName()) as $namespaceChunk) {
         $baseNamespaceChunks[] = $namespaceChunk;
         if ($namespaceChunk == consoleBase::COMMANDS_DIRECTORY) {
             break;
         }
     }
     $namespace = str_replace(implode('\\', $baseNamespaceChunks), '', get_called_class());
     $namespace = trim($namespace, '\\');
     $commandNameData = explode('\\', $namespace);
     $phpdoc = new DocBlock($reflection);
     /** @var DocBlock\Tag $tag */
     $tag = reset($phpdoc->getTagsByName('consoleNs'));
     $commandNameValues = [];
     if ($tag) {
         $consoleNs = trim($tag->getDescription());
         if (!empty($consoleNs)) {
             $commandNameValues[] = $consoleNs;
         }
     }
     foreach ($commandNameData as $commandNameValue) {
         $commandNameValues[] = $commandNameValue;
     }
     $this->setName(implode(':', $commandNameValues))->setDescription($phpdoc->getShortDescription())->setHelp($phpdoc->getLongDescription());
     $this->defineArguments();
 }
开发者ID:mpcmf,项目名称:mpcmf-console,代码行数:29,代码来源:consoleCommandBase.php

示例3: addDescription

 protected function addDescription(\DOMElement $child, \phpDocumentor\Reflection\DocBlock $docblock)
 {
     $node = $child->ownerDocument->createCDATASection($docblock->getShortDescription());
     $description = new \DOMElement('description');
     $child->appendChild($description);
     $description->appendChild($node);
 }
开发者ID:nosenaoki,项目名称:phpDocumentor2,代码行数:7,代码来源:DocBlockExporter.php

示例4: parse

 /**
  * Parse the docBlock comment for this command, and set the
  * fields of this class with the data thereby obtained.
  */
 public function parse()
 {
     $docblockComment = $this->reflection->getDocComment();
     $phpdoc = new DocBlock($docblockComment);
     // First set the description (synopsis) and help.
     $this->commandInfo->setDescription((string) $phpdoc->getShortDescription());
     $this->commandInfo->setHelp((string) $phpdoc->getLongDescription());
     $this->processAllTags($phpdoc);
 }
开发者ID:consolidation,项目名称:annotated-command,代码行数:13,代码来源:CommandDocBlockParser2.php

示例5: getMethodDesc

 public function getMethodDesc($methodName)
 {
     if (!$this->reflection->hasMethod($methodName)) {
         return null;
     }
     $docComment = $this->reflection->getMethod($methodName)->getDocComment();
     if ($docComment) {
         $docBlock = new DocBlock($docComment);
         return join(' ', [$docBlock->getShortDescription(), $docBlock->getLongDescription()]);
     }
     return null;
 }
开发者ID:jiangrongyong,项目名称:docgen,代码行数:12,代码来源:AnnotationParser.php

示例6: parsePropertyDocBlock

 /**
  * 
  * @param ReflectionProperty $reflector
  * @return ParsePropertyBlockResult
  */
 public function parsePropertyDocBlock(ReflectionProperty $reflector)
 {
     $phpdoc = new DocBlock($reflector->getDocComment());
     /* @var $varTags VarTag[] */
     $varTags = $phpdoc->getTagsByName("var");
     /* @var $varTag VarTag */
     $varTag = $varTags[0];
     $result = new ParsePropertyBlockResult();
     $result->description = $phpdoc->getShortDescription();
     $result->type = (string) $varTag->getType();
     return $result;
 }
开发者ID:Kaemmelot,项目名称:php-type-reflection,代码行数:17,代码来源:DocBlockParser.php

示例7: getMethodsDetails

 public function getMethodsDetails()
 {
     $methods = [];
     foreach ($this->reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
         $docblock = new DocBlock($method);
         $data = ['shortDescription' => $docblock->getShortDescription(), 'longDescription' => $docblock->getLongDescription(), 'argumentsList' => $this->retriveParams($docblock->getTagsByName('param')), 'argumentsDescription' => $this->retriveParamsDescription($docblock->getTagsByName('param')), 'returnValue' => $this->retriveReturnValue($docblock->getTagsByName('return')), 'visibility' => join('', [$method->isFinal() ? 'final ' : '', 'public', $method->isStatic() ? ' static' : ''])];
         if (strlen($data['shortDescription'])) {
             $methods[$method->getName()] = (object) $data;
         }
     }
     return $methods;
 }
开发者ID:vakata,项目名称:phpdoc-md,代码行数:12,代码来源:ClassParser.php

示例8: parseClass

 /**
  * @param $doc
  * @return bool
  */
 public function parseClass(ControllerDoc $doc)
 {
     if (!($docBlock = new DocBlock($this->reflection))) {
         return false;
     }
     $doc->longDescription = $docBlock->getLongDescription()->getContents();
     $doc->shortDescription = $docBlock->getShortDescription();
     $doc->populateTags($docBlock);
     if (DocBlockHelper::isInherit($docBlock)) {
         $parentParser = $this->getParentParser();
         $parentParser->parseClass($doc);
     }
 }
开发者ID:EvgenyGavrilov,项目名称:yii2-rest-doc,代码行数:17,代码来源:ControllerParser.php

示例9: extractAction

 /**
  * {@inheritDoc}
  */
 public function extractAction(ActionInterface $action)
 {
     $callable = $this->callableResolver->resolve($action);
     if ($this->parameterExtractor) {
         $parameters = $this->parameterExtractor->extract($action, $callable);
     } else {
         $parameters = [];
     }
     $reflection = $callable->getReflection();
     $docBlock = new DocBlock($reflection);
     $description = $docBlock->getShortDescription();
     $actionDoc = new Action($action->getName(), $description, $parameters);
     return $actionDoc;
 }
开发者ID:rockefys,项目名称:Api,代码行数:17,代码来源:ActionExtractor.php

示例10: assembleDocBlock

 /**
  * Assemble DocBlock.
  *
  * @param DocBlock|null      $docBlock
  * @param DescriptorAbstract $target
  *
  * @return void
  */
 protected function assembleDocBlock($docBlock, $target)
 {
     if (!$docBlock) {
         return;
     }
     $target->setSummary($docBlock->getShortDescription());
     $target->setDescription($docBlock->getLongDescription()->getContents());
     /** @var DocBlock\Tag $tag */
     foreach ($docBlock->getTags() as $tag) {
         $tagDescriptor = $this->builder->buildDescriptor($tag);
         // allow filtering of tags
         if (!$tagDescriptor) {
             continue;
         }
         $target->getTags()->get($tag->getName(), new Collection())->add($tagDescriptor);
     }
 }
开发者ID:crazycodr,项目名称:phpDocumentor2,代码行数:25,代码来源:AssemblerAbstract.php

示例11: getEndpoints

 /**
  * Returns an array of endpoints
  *
  * @return array
  */
 protected function getEndpoints()
 {
     $endpoints = [];
     foreach ($this->routes as $route) {
         $array = explode("@", $route['action']);
         $class = $array[0];
         if ($class == "Closure") {
             // check for api/v1/docs
             if (strpos($route['uri'], $this->prefix . '/docs') !== false) {
                 continue;
             }
         }
         $reflector = new ReflectionClass($class);
         $docBlock = new DocBlock($reflector);
         // remove Controller
         $class = str_replace('Controller', '', $class);
         $endpoints["{$class}"]['methods'] = [];
         $endpoints["{$class}"]['description'] = $docBlock->getShortDescription();
     }
     return $this->getEndpointMethods($endpoints);
 }
开发者ID:EugeneTelyatnik,项目名称:apidocs,代码行数:26,代码来源:ApiDocsGenerator.php

示例12: parse

 public function parse($comment, ParserContext $context)
 {
     $docBlock = null;
     $errorMessage = '';
     try {
         $docBlockContext = new DocBlock\Context($context->getNamespace(), $context->getAliases() ?: array());
         $docBlock = new DocBlock((string) $comment, $docBlockContext);
     } catch (\Exception $e) {
         $errorMessage = $e->getMessage();
     }
     $result = new DocBlockNode();
     if ($errorMessage) {
         $result->addError($errorMessage);
         return $result;
     }
     $result->setShortDesc($docBlock->getShortDescription());
     $result->setLongDesc((string) $docBlock->getLongDescription());
     foreach ($docBlock->getTags() as $tag) {
         $result->addTag($tag->getName(), $this->parseTag($tag));
     }
     return $result;
 }
开发者ID:kpocha,项目名称:Sami,代码行数:22,代码来源:DocBlockParser.php

示例13: fetchMethod

 public function fetchMethod($className, $method)
 {
     $phpdoc = new DocBlock($method->getDocComment());
     $call = array();
     $params = array();
     $return = null;
     // build the call example string
     foreach ($method->getParameters() as $param) {
         if ($param->isOptional()) {
             try {
                 $value = var_export($param->getDefaultValue(), true);
                 $value = str_replace(PHP_EOL, '', $value);
                 $value = str_replace('NULL', 'null', $value);
                 $value = str_replace('array ()', 'array()', $value);
                 $call[] = '$' . $param->getName() . ' = ' . $value;
             } catch (Exception $e) {
                 $call[] = '$' . $param->getName();
             }
         } else {
             $call[] = '$' . $param->getName();
         }
     }
     // get all parameter docs
     foreach ($phpdoc->getTags() as $tag) {
         switch ($tag->getName()) {
             case 'param':
                 $params[] = array('name' => $tag->getVariableName(), 'type' => $tag->getType(), 'text' => $tag->getDescription());
                 break;
             case 'return':
                 $return = array('type' => $tag->getType(), 'text' => $tag->getDescription());
                 break;
         }
     }
     // a::first
     $methodName = strtolower($className) . '::' . $method->getName();
     $methodSlug = str::slug($method->getName());
     // build the full method array
     return array('name' => $methodName, 'slug' => $methodSlug, 'excerpt' => str_replace(PHP_EOL, ' ', $phpdoc->getShortDescription()), 'call' => $methodName . '(' . implode(', ', $call) . ')', 'return' => $return, 'params' => $params);
 }
开发者ID:mzur,项目名称:getkirby.com,代码行数:39,代码来源:documentor.php

示例14: findSummary

 protected function findSummary(\ReflectionClass $scopeClass, \ReflectionMethod $scopeMethod, Language $lang = null, &$alreadyScopedClasses = array())
 {
     foreach ($alreadyScopedClasses as $sc) {
         /* @var \ReflectionClass $sc */
         if ($sc->getName() === $scopeClass->getName()) {
             return null;
         }
     }
     $alreadyScopedClasses[] = $scopeClass;
     $doc = new DocBlock($scopeMethod);
     $result = $doc->getShortDescription();
     if ('{@inheritdoc}' === \trim(\strtolower($result))) {
         $result = null;
         $typesToCheck = \array_merge($scopeClass->getTraits(), [$scopeClass->getParentClass()], $scopeClass->getInterfaces());
         foreach ($typesToCheck as $type) {
             if (!$type instanceof \ReflectionClass) {
                 continue;
             }
             $matchingMethod = null;
             foreach ($type->getMethods() as $otherMethod) {
                 if ($otherMethod->getName() !== $scopeMethod->getName()) {
                     continue;
                 }
                 $matchingMethod = $otherMethod;
             }
             if (!$matchingMethod instanceof \ReflectionMethod) {
                 continue;
             }
             $summary = \trim($this->findSummary($type, $matchingMethod, $lang, $alreadyScopedClasses));
             if ('' !== $summary) {
                 $result = $summary;
             }
         }
     }
     $result = \trim($result);
     return '' !== $result ? $result : null;
 }
开发者ID:SourceCode,项目名称:phpLINQ,代码行数:37,代码来源:Method_.php

示例15: extractParameters

 /**
  * @param string $class
  * @param array  $processed
  *
  * @return array
  */
 private function extractParameters($class, $processed = [])
 {
     if (isset($processed[$class])) {
         return [];
     }
     $processed[$class] = true;
     $reflectionClass = new \ReflectionClass($class);
     $parameters = [];
     foreach ($reflectionClass->getProperties() as $reflectionProperty) {
         $type = $this->determinePropertyType($reflectionProperty);
         $isCollection = false;
         if ($extractedType = $this->typeResolver->extractTypeFromCollectionType($type)) {
             $isCollection = true;
             $type = $extractedType;
         }
         $docBlock = new DocBlock($reflectionProperty);
         $parameter = ['name' => $reflectionProperty->getName(), 'description' => $docBlock->getShortDescription(), 'type' => $type . ($isCollection ? '[]' : '')];
         if (class_exists($type)) {
             $parameter = array_merge($parameter, ['type' => 'object' . ($isCollection ? '[]' : ''), 'properties' => $this->extractParameters($type, $processed)]);
         }
         $parameters[] = $parameter;
     }
     return $parameters;
 }
开发者ID:tonicforhealth,项目名称:json-rpc,代码行数:30,代码来源:MetadataExtractor.php


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