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


PHP AnnotationsParser::getAll方法代码示例

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


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

示例1: createFromFiles

 /**
  * Create ProcessSet from given files, optionally filtering by given $groups and $excludeGroups
  *
  * @param Finder $files
  * @param array $groups Groups to be run
  * @param array $excludeGroups Groups to be excluded
  * @param string $filter filter test cases by name
  * @return ProcessSet
  */
 public function createFromFiles(Finder $files, array $groups = null, array $excludeGroups = null, $filter = null)
 {
     $files->sortByName();
     $processSet = $this->getProcessSet();
     if ($groups || $excludeGroups || $filter) {
         $this->output->writeln('Filtering testcases:');
     }
     if ($groups) {
         $this->output->writeln(sprintf(' - by group(s): %s', implode(', ', $groups)));
     }
     if ($excludeGroups) {
         $this->output->writeln(sprintf(' - excluding group(s): %s', implode(', ', $excludeGroups)));
     }
     if ($filter) {
         $this->output->writeln(sprintf(' - by testcase/test name: %s', $filter));
     }
     $testCasesNum = 0;
     foreach ($files as $file) {
         $fileName = $file->getRealpath();
         // Parse classes from the testcase file
         $classes = AnnotationsParser::parsePhp(\file_get_contents($fileName));
         // Get annotations for the first class in testcase (one file = one class)
         $annotations = AnnotationsParser::getAll(new \ReflectionClass(key($classes)));
         // Filter out test-cases having any of excluded groups
         if ($excludeGroups && array_key_exists('group', $annotations) && count($excludingGroups = array_intersect($excludeGroups, $annotations['group']))) {
             if ($this->output->isDebug()) {
                 $this->output->writeln(sprintf('Excluding testcase file %s with group %s', $fileName, implode(', ', $excludingGroups)));
             }
             continue;
         }
         // Filter out test-cases without any matching group
         if ($groups) {
             if (!array_key_exists('group', $annotations) || !count($matchingGroups = array_intersect($groups, $annotations['group']))) {
                 continue;
             }
             if ($this->output->isDebug()) {
                 $this->output->writeln(sprintf('Found testcase file #%d in group %s: %s', ++$testCasesNum, implode(', ', $matchingGroups), $fileName));
             }
         } else {
             if ($this->output->isDebug()) {
                 $this->output->writeln(sprintf('Found testcase file #%d: %s', ++$testCasesNum, $fileName));
             }
         }
         $phpunitArgs = ['--log-junit=logs/' . Strings::webalize(key($classes), null, $lower = false) . '.xml', '--configuration=' . realpath(__DIR__ . '/../phpunit.xml')];
         if ($filter) {
             $phpunitArgs[] = '--filter=' . $filter;
         }
         // If ANSI output is enabled, turn on colors in PHPUnit
         if ($this->output->isDecorated()) {
             $phpunitArgs[] = '--colors=always';
         }
         $processSet->add($this->buildProcess($fileName, $phpunitArgs), key($classes), $delayAfter = !empty($annotations['delayAfter']) ? current($annotations['delayAfter']) : '', $delayMinutes = !empty($annotations['delayMinutes']) ? current($annotations['delayMinutes']) : null);
     }
     return $processSet;
 }
开发者ID:mhujer,项目名称:steward,代码行数:64,代码来源:ProcessSetCreator.php

示例2: startTest

 public function startTest(\PHPUnit_Framework_Test $test)
 {
     if ($test instanceof \PHPUnit_Framework_Warning) {
         return;
     }
     if (!$test instanceof AbstractTestCase) {
         throw new \InvalidArgumentException('Test case must be descendant of Lmc\\Steward\\Test\\AbstractTestCase');
     }
     $config = ConfigProvider::getInstance();
     // Initialize NullWebDriver if self::NO_BROWSER_ANNOTATION is used on testcase class or test method
     $testCaseAnnotations = AnnotationsParser::getAll(new \ReflectionClass($test));
     $testAnnotations = AnnotationsParser::getAll(new \ReflectionMethod($test, $test->getName(false)));
     if (isset($testCaseAnnotations[self::NO_BROWSER_ANNOTATION]) || isset($testAnnotations[self::NO_BROWSER_ANNOTATION])) {
         $test->wd = new NullWebDriver();
         $test->log('Initializing Null WebDriver for "%s::%s" (@%s annotation used %s)', get_class($test), $test->getName(), self::NO_BROWSER_ANNOTATION, isset($testCaseAnnotations[self::NO_BROWSER_ANNOTATION]) ? 'on class' : 'on method');
         return;
     }
     // Initialize real WebDriver otherwise
     $test->log('Initializing "%s" WebDriver for "%s::%s"', $config->browserName, get_class($test), $test->getName());
     $capabilities = new \DesiredCapabilities([\WebDriverCapabilityType::BROWSER_NAME => $config->browserName, \WebDriverCapabilityType::PLATFORM => \WebDriverPlatform::ANY]);
     $this->createWebDriver($test, $config->serverUrl . '/wd/hub', $this->setupCustomCapabilities($capabilities, $config->browserName), $connectTimeoutMs = 2 * 60 * 1000, $requestTimeoutMs = 60 * 60 * 1000);
 }
开发者ID:mhujer,项目名称:steward,代码行数:22,代码来源:WebDriverListener.php

示例3: getAnnotations

 /**
  * Returns all annotations.
  * @return IAnnotation[][]
  */
 public function getAnnotations()
 {
     return AnnotationsParser::getAll($this);
 }
开发者ID:jurasm2,项目名称:nette,代码行数:8,代码来源:ClassType.php

示例4: getAnnotation

 /**
  * Returns an annotation value.
  *
  * @param  string
  *
  * @return IAnnotation
  */
 public function getAnnotation($name)
 {
     $res = AnnotationsParser::getAll($this);
     return isset($res[$name]) ? end($res[$name]) : null;
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:12,代码来源:Method.php

示例5: mapClasses

 /**
  * Scan discoverable paths and get actions
  *
  * @return array
  */
 public function mapClasses()
 {
     $paths = $this->config->getDiscovererPaths();
     $files = $classMap = [];
     foreach ($paths as $path) {
         $files = array_merge($files, $this->loadDir($path));
     }
     foreach ($files as $file) {
         $fileContent = file_get_contents($file);
         $classes = array_keys(AnnotationsParser::parsePhp($fileContent));
         Config::includeFile($file);
         foreach ($classes as $className) {
             $class = new \ReflectionClass($className);
             if (!$class->isInstantiable()) {
                 continue;
             }
             $classAnnotations = AnnotationsParser::getAll($class);
             if (!isset($classAnnotations['ExtDirect'])) {
                 continue;
             }
             $methods = $this->getMethods($class);
             $classAlias = null;
             if (isset($classAnnotations['ExtDirect\\Alias'])) {
                 if (is_array($classAnnotations['ExtDirect\\Alias']) && is_string($classAnnotations['ExtDirect\\Alias'][0])) {
                     $classAlias = $classAnnotations['ExtDirect\\Alias'][0];
                 }
             }
             $actionName = $classAlias ?: $className;
             $classMap[$actionName]['action'] = $actionName;
             $classMap[$actionName]['class'] = $className;
             $classMap[$actionName]['file'] = $file;
             $classMap[$actionName]['methods'] = $methods;
         }
     }
     return $classMap;
 }
开发者ID:danielbragaalmeida,项目名称:extdirect,代码行数:41,代码来源:Discoverer.php

示例6:

isset($res[$name])?end($res[$name]):NULL;}function
getAnnotations(){return
AnnotationsParser::getAll($this);}function
开发者ID:JanTvrdik,项目名称:NetteExtras,代码行数:3,代码来源:loader.php


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