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


PHP ReflectionClass::getDocComment方法代码示例

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


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

示例1: getAnnotationReflection

 /**
  * @return IAnnotationReflection
  */
 public function getAnnotationReflection()
 {
     if ($this->annotationReflection === null) {
         $this->annotationReflection = AnnotationReflection::build($this->reflectionClass->getDocComment());
     }
     return $this->annotationReflection;
 }
开发者ID:edde-framework,项目名称:edde,代码行数:10,代码来源:ReflectionReflection.php

示例2: from

 /**
  * @param  \ReflectionClass|string
  * @return self
  */
 public static function from($from)
 {
     $from = new \ReflectionClass($from instanceof \ReflectionClass ? $from->getName() : $from);
     if (PHP_VERSION_ID >= 70000 && $from->isAnonymous()) {
         $class = new static('anonymous');
     } else {
         $class = new static($from->getShortName(), new PhpNamespace($from->getNamespaceName()));
     }
     $class->type = $from->isInterface() ? 'interface' : (PHP_VERSION_ID >= 50400 && $from->isTrait() ? 'trait' : 'class');
     $class->final = $from->isFinal() && $class->type === 'class';
     $class->abstract = $from->isAbstract() && $class->type === 'class';
     $class->implements = $from->getInterfaceNames();
     $class->documents = $from->getDocComment() ? array(preg_replace('#^\\s*\\* ?#m', '', trim($from->getDocComment(), "/* \r\n\t"))) : array();
     if ($from->getParentClass()) {
         $class->extends = $from->getParentClass()->getName();
         $class->implements = array_diff($class->implements, $from->getParentClass()->getInterfaceNames());
     }
     foreach ($from->getProperties() as $prop) {
         if ($prop->getDeclaringClass()->getName() === $from->getName()) {
             $class->properties[$prop->getName()] = Property::from($prop);
         }
     }
     foreach ($from->getMethods() as $method) {
         if ($method->getDeclaringClass()->getName() === $from->getName()) {
             $class->methods[$method->getName()] = Method::from($method)->setNamespace($class->namespace);
         }
     }
     return $class;
 }
开发者ID:luminousinfoways,项目名称:pccfoas,代码行数:33,代码来源:ClassType.php

示例3: getXmlNamespace

 /**
  *
  */
 public function getXmlNamespace()
 {
     $namespace = $this->_parseAnnotation($this->reflection->getDocComment(), 'xmlNamespace');
     if (!$namespace && $this->configuration) {
         $namespace = $this->configuration->getXmlNamespace($this->reflection->getNamespaceName());
     }
     return $namespace;
 }
开发者ID:ddvzwzjm,项目名称:xml-serializer,代码行数:11,代码来源:ClassMetadata.php

示例4: description

 /**
  * @return string|null
  */
 public function description()
 {
     $docComment = $this->class->getDocComment();
     if (!$docComment) {
         return null;
     }
     return $this->parser->parse(implode("\n", array_map(function ($line) {
         return ltrim($line, " *\r\n\t");
     }, array_slice(explode("\n", $docComment), 1, -1))));
 }
开发者ID:rtens,项目名称:domin,代码行数:13,代码来源:ObjectAction.php

示例5: _initClass

 protected function _initClass($class)
 {
     $class = trim($class);
     if (!empty($class)) {
         $this->_class = new \ReflectionClass($class);
         $docComment = $this->_class->getDocComment();
         $docComment = new DocBloc($docComment);
         $this->_annotations = $docComment->getAnnotations();
         $this->_parseProperties();
         $this->_parseMethods();
     }
 }
开发者ID:richardjohn,项目名称:FlowProject,代码行数:12,代码来源:AnnotatedClass.php

示例6: _init

 protected function _init()
 {
     $docComment = $this->_reflectionClass->getDocComment();
     $rows = explode("\n", $docComment);
     foreach ($rows as $row) {
         if (preg_match('/\\@property/ui', $row)) {
             $property = new Mongostar_Model_Reflection_Property($row);
             if ($property->name) {
                 $this->_properties[$property->name] = $property;
             }
         }
     }
 }
开发者ID:execrot,项目名称:mongostar,代码行数:13,代码来源:Reflection.php

示例7: getClassAnnotations

 /**
  * @return array[]
  */
 public function getClassAnnotations()
 {
     if (isset($this->classAnnotations)) {
         return $this->classAnnotations;
     }
     $docblock = $this->class->getDocComment();
     if ($docblock === false) {
         $this->classAnnotations = array();
     } else {
         $this->classAnnotations = $this->parser->parse($docblock, "class", $this->_getNamespaces());
     }
     return $this->classAnnotations;
 }
开发者ID:siad007,项目名称:php-weasel,代码行数:16,代码来源:AnnotationReader.php

示例8: ReflectionClass

 /**
  * PHPUnit_Retriable_TestCase constructor. Receives the same arguments as
  * {@link PHPUnit_Framework_TestCase::__construct() the standard PHPUnit constructor}.
  *
  * @author Art <a.molcanovas@gmail.com>
  *
  * @param string $name
  * @param array  $data
  * @param string $dataName
  */
 function __construct($name = null, array $data = [], $dataName = '')
 {
     $this->thisReflect = new ReflectionClass($this);
     if ($doc = $this->thisReflect->getDocComment()) {
         $parsed = DocBlockFactoryManager::getFactory()->create($doc);
         if ($parsed->hasTag(SleepTime::NAME)) {
             $this->sleepTime = (int) $parsed->getTagsByName(SleepTime::NAME)[0]->__toString();
         }
         if ($parsed->hasTag(RetryCount::NAME)) {
             $this->retryCount = (int) $parsed->getTagsByName(RetryCount::NAME)[0]->__toString();
         }
     }
     parent::__construct($name, $data, $dataName);
 }
开发者ID:alorel,项目名称:phpunit-auto-rerun,代码行数:24,代码来源:PHPUnit_Retriable_TestCase.php

示例9: __construct

 /**
  * @param string $class Entity class name
  *
  * @throws Exception\InvalidArgumentException
  * @throws Exception\EntityException
  */
 public function __construct($class)
 {
     $this->className = (string) $class;
     if (!is_subclass_of($this->className, "UniMapper\\Entity")) {
         throw new Exception\InvalidArgumentException("Class must be subclass of UniMapper\\Entity but " . $this->className . " given!", $this->className);
     }
     $reflection = new \ReflectionClass($this->className);
     $this->fileName = $reflection->getFileName();
     foreach ($reflection->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
         if ($property->isStatic()) {
             continue;
         }
         $this->publicProperties[] = $property->getName();
     }
     // Register reflection
     self::load($this);
     $docComment = $reflection->getDocComment();
     // Parse adapter
     try {
         $adapter = Reflection\Annotation::parseAdapter($docComment);
         if ($adapter) {
             list($this->adapterName, $this->adapterResource) = $adapter;
         }
     } catch (Exception\AnnotationException $e) {
         throw new Exception\EntityException($e->getMessage(), $this->className, $e->getDefinition());
     }
     // Parse properties
     $this->_parseProperties($docComment);
 }
开发者ID:bauer01,项目名称:unimapper,代码行数:35,代码来源:Reflection.php

示例10: getActionResult

 private static function getActionResult($controller, $action)
 {
     $controller = $controller . '_controller';
     if (!class_exists($controller)) {
         throw new WebException($controller, $action, "Can't find controller - [{$controller}]");
     }
     if (!method_exists($controller, $action)) {
         throw new WebException($controller, $action, "Can't find action [{$action}] in [{$controller}]");
     }
     /**
      * @var Controller $controller
      */
     $controller = DI::get($controller);
     $ref = new \ReflectionClass($controller);
     $controller->attributes = AttributeCollection::create($ref->getDocComment());
     $controller->req = DI::get(Request::class);
     $pageLoadResult = $controller->onPageLoad();
     if (isset($pageLoadResult)) {
         return $pageLoadResult;
     }
     if (!$controller->isEnded) {
         $actionInfo = new ActionInfo($controller, $action);
         try {
             $actionResult = $actionInfo->invoke($controller->req->params(), $controller->req->posts());
             return $actionResult;
         } catch (\Exception $ex) {
             if ($controller instanceof OutputStatusException || $actionInfo->getIfOutputStatusException() || $controller->attributes->exists(OutputStatusExceptionAttribute::class)) {
                 $status = $controller->status($ex->getMessage(), $ex->getCode());
                 return $status;
             }
             throw new WebException($controller, $action, $ex->getMessage(), $ex);
         }
     }
     return null;
 }
开发者ID:sanzhumu,项目名称:xaircraft1.1,代码行数:35,代码来源:Controller.php

示例11: _createPath

 /**
  * create the path for the cache file
  */
 private function _createPath()
 {
     $config = jApp::config();
     //Check module availability
     if (!isset($config->_modulesPathList[$this->module])) {
         throw new jExceptionSelector('jelix~errors.module.unknown', $this->module);
     }
     //Build controller path
     $this->_ctrlpath = $config->_modulesPathList[$this->module] . 'controllers/' . $this->controller . '.soap.php';
     //Check controller availability
     if (!file_exists($this->_ctrlpath)) {
         throw new jException('jelix~errors.action.unknown', $this->controller);
     }
     //Check controller declaration
     require_once $this->_ctrlpath;
     $this->controllerClassName = $this->controller . 'Ctrl';
     if (!class_exists($this->controllerClassName, false)) {
         throw new jException('jelix~errors.ad.controller.class.unknown', array('jWSDL', $this->controllerClassName, $this->_ctrlpath));
     }
     //Check eAccelerator configuration in order to Reflexion API work
     if (extension_loaded('eAccelerator')) {
         $reflect = new ReflectionClass('jWSDL');
         if ($reflect->getDocComment() == NULL) {
             throw new jException('jsoap~errors.eaccelerator.configuration');
         }
         unset($reflect);
     }
 }
开发者ID:laurentj,项目名称:lizmap-web-client,代码行数:31,代码来源:jWSDL.php

示例12: handle

 public function handle()
 {
     $this->checkArgs(array('table'));
     $namespace = array_key_exists('namespace', $this->args) ? $this->args['namespace'] : null;
     if (!isset($namespace)) {
         $namespace = array_key_exists('ns', $this->args) ? $this->args['ns'] : null;
     }
     $table = $this->args['table'];
     $class = array_key_exists('class', $this->args) ? $this->args['class'] : Strings::snakeToCamel($table);
     $path = $this->path($class, $namespace);
     $schema = new TableSchema($table);
     if (file_exists($path)) {
         $content = File::readText($path);
         $className = isset($namespace) ? "{$namespace}\\{$class}" : $class;
         $reflection = new \ReflectionClass($className);
         $header = $reflection->getDocComment();
         if (isset($header)) {
             $content = str_replace($header, Template::generateHeader($schema->columns()), $content);
             unlink($path);
             File::writeText($path, $content);
         }
         Console::line("Model [{$class}] updated in path [{$path}].");
     } else {
         File::writeText($path, Template::generateModel($table, $class, $schema->columns(), $namespace));
         Console::line("Model [{$class}] created in path [{$path}].");
     }
 }
开发者ID:sanzhumu,项目名称:xaircraft1.1,代码行数:27,代码来源:SingleModelGenerator.php

示例13: parse

 /**
  * @inheritdoc
  */
 public function parse($file, $annotationName = null)
 {
     $data = array();
     $class = $this->findClass($file);
     $ref = new \ReflectionClass($class);
     $annotations = $this->resolveAnnotations($ref->getDocComment());
     foreach ($annotations as $annotation) {
         if (!$annotationName || preg_match($annotationName, $annotation['key'])) {
             $data[] = array('class' => $class, 'key' => $annotation['key'], 'value' => (array) Yaml::parse($annotation['value']), 'metadata' => array('class' => $class));
         }
     }
     foreach ($ref->getProperties() as $property) {
         $annotations = $this->resolveAnnotations($property->getDocComment());
         foreach ($annotations as $annotation) {
             if (!$annotationName || preg_match($annotationName, $annotation['key'])) {
                 $data[] = array('property' => $property->getName(), 'key' => $annotation['key'], 'value' => (array) Yaml::parse($annotation['value']), 'metadata' => array('class' => $class));
             }
         }
     }
     foreach ($ref->getMethods() as $method) {
         $annotations = $this->resolveAnnotations($method->getDocComment());
         foreach ($annotations as $annotation) {
             if (!$annotationName || preg_match($annotationName, $annotation['key'])) {
                 $data[] = array('method' => $method->getName(), 'key' => $annotation['key'], 'value' => (array) Yaml::parse($annotation['value']), 'metadata' => array('class' => $class));
             }
         }
     }
     return $data;
 }
开发者ID:yosmanyga,项目名称:resource,代码行数:32,代码来源:DocParser.php

示例14: document

 /**
  *
  * @param string $view
  * @param array  $options
  * @param string $class
  * @return string
  */
 public function document($ns, $view, $options, $class)
 {
     $inspector = new \ReflectionClass($this);
     list($description, $tags) = $this->parseDoccomment($inspector->getDocComment());
     $doc = $this->view($view, ['description' => $description, 'tags' => (array) $tags, 'options' => $options, 'class' => $class], $ns);
     return $doc;
 }
开发者ID:scalephp,项目名称:kernel,代码行数:14,代码来源:Documenter.php

示例15: run

 /**
  * Run TestCase.
  *
  * @param TestCase $testCase
  *
  * @return int Status code
  */
 public function run(TestCase $testCase)
 {
     $this->precondition($testCase);
     if ($this->tests->count() == 0) {
         $this->logger->notice('Tests not found in TestCase', ['pid' => getmypid()]);
         /** @var EventDispatcherInterface $dispatcher */
         $dispatcher = $this->container->get('dispatcher');
         $dispatcher->dispatch(EventStorage::EV_CASE_FILTERED);
         return 1;
     }
     $statusCode = 0;
     $testCaseEvent = new TestCaseEvent($this->reflectionClass->getName());
     $testCaseEvent->setAnnotations(self::getAnnotations($this->reflectionClass->getDocComment()));
     $this->controller->beforeCase($testCaseEvent);
     foreach ($this->tests as $test) {
         if ($test->getStatus() !== TestMeta::TEST_NEW && $test->getStatus() !== TestMeta::TEST_MARKED) {
             continue;
         }
         if ($this->testMethod($test)) {
             $statusCode = 1;
         }
     }
     $this->controller->afterCase($testCaseEvent);
     return $statusCode;
 }
开发者ID:komex,项目名称:unteist,代码行数:32,代码来源:Runner.php


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