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


PHP PHP_Token_Stream::getFunctions方法代码示例

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


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

示例1: testAnonymousClassesAreHandledCorrectly2

 /**
  * @requires PHP 7
  * @ticket   https://github.com/sebastianbergmann/php-token-stream/issues/52
  */
 public function testAnonymousClassesAreHandledCorrectly2()
 {
     $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'class_with_method_that_declares_anonymous_class2.php');
     $classes = $ts->getClasses();
     $this->assertEquals(array('Test'), array_keys($classes));
     $this->assertEquals(array('methodOne', 'methodTwo'), array_keys($classes['Test']['methods']));
     $this->assertEmpty($ts->getFunctions());
 }
开发者ID:cruni505,项目名称:prestomed,代码行数:12,代码来源:ClassTest.php

示例2: testSignature

 public function testSignature()
 {
     $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'source5.php');
     $f = $ts->getFunctions();
     $c = $ts->getClasses();
     $i = $ts->getInterfaces();
     $this->assertEquals('foo($a, array $b, array $c = array())', $f['foo']['signature']);
     $this->assertEquals('m($a, array $b, array $c = array())', $c['c']['methods']['m']['signature']);
     $this->assertEquals('m($a, array $b, array $c = array())', $c['a']['methods']['m']['signature']);
     $this->assertEquals('m($a, array $b, array $c = array())', $i['i']['methods']['m']['signature']);
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:11,代码来源:FunctionTest.php

示例3: processFunctions

 /**
  * @param \PHP_Token_Stream $tokens
  */
 protected function processFunctions(\PHP_Token_Stream $tokens)
 {
     $functions = $tokens->getFunctions();
     unset($tokens);
     $link = $this->getId() . '.html#';
     foreach ($functions as $functionName => $function) {
         $this->functions[$functionName] = ['functionName' => $functionName, 'signature' => $function['signature'], 'startLine' => $function['startLine'], 'executableLines' => 0, 'executedLines' => 0, 'ccn' => $function['ccn'], 'coverage' => 0, 'crap' => 0, 'link' => $link . $function['startLine']];
         $this->startLines[$function['startLine']] =& $this->functions[$functionName];
         $this->endLines[$function['endLine']] =& $this->functions[$functionName];
     }
 }
开发者ID:thanghexp,项目名称:project,代码行数:14,代码来源:File.php

示例4: processUncoveredFilesFromWhitelist

 /**
  * Processes whitelisted files that are not covered.
  */
 protected function processUncoveredFilesFromWhitelist()
 {
     $data = array();
     $uncoveredFiles = array_diff($this->filter->getWhitelist(), array_keys($this->data));
     foreach ($uncoveredFiles as $uncoveredFile) {
         if (!file_exists($uncoveredFile)) {
             continue;
         }
         if ($this->cacheTokens) {
             $tokens = PHP_Token_Stream_CachingFactory::get($uncoveredFile);
         } else {
             $tokens = new PHP_Token_Stream($uncoveredFile);
         }
         $classes = $tokens->getClasses();
         $interfaces = $tokens->getInterfaces();
         $functions = $tokens->getFunctions();
         unset($tokens);
         foreach (array_keys($classes) as $class) {
             if (class_exists($class, FALSE)) {
                 continue 2;
             }
         }
         unset($classes);
         foreach (array_keys($interfaces) as $interface) {
             if (interface_exists($interface, FALSE)) {
                 continue 2;
             }
         }
         unset($interfaces);
         foreach (array_keys($functions) as $function) {
             if (function_exists($function)) {
                 continue 2;
             }
         }
         unset($functions);
         $this->driver->start();
         include_once $uncoveredFile;
         $coverage = $this->driver->stop();
         foreach ($coverage as $file => $fileCoverage) {
             if (!isset($data[$file]) && in_array($file, $uncoveredFiles)) {
                 foreach (array_keys($fileCoverage) as $key) {
                     if ($fileCoverage[$key] == 1) {
                         $fileCoverage[$key] = -1;
                     }
                 }
                 $data[$file] = $fileCoverage;
             }
         }
     }
     $this->append($data, 'UNCOVERED_FILES_FROM_WHITELIST');
 }
开发者ID:qube81,项目名称:old-phpunit,代码行数:54,代码来源:CodeCoverage.php

示例5: testImportedFunctionsAreHandledCorrectly

 /**
  * @requires PHP 5.6
  */
 public function testImportedFunctionsAreHandledCorrectly()
 {
     $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'classUsesNamespacedFunction.php');
     $this->assertEmpty($ts->getFunctions());
 }
开发者ID:diandianxiyu,项目名称:ApiTesting,代码行数:8,代码来源:ClassTest.php

示例6: processFunctions

 protected function processFunctions()
 {
     if ($this->cacheTokens) {
         $tokens = PHP_Token_Stream_CachingFactory::get($this->getPath());
     } else {
         $tokens = new PHP_Token_Stream($this->getPath());
     }
     $functions = $tokens->getFunctions();
     unset($tokens);
     if (count($functions) > 0 && !isset($this->classes['*'])) {
         $this->classes['*'] = array('methods' => array(), 'startLine' => 0, 'executableLines' => 0, 'executedLines' => 0, 'ccn' => 0);
     }
     foreach ($functions as $functionName => $function) {
         $this->classes['*']['methods'][$functionName] = array('signature' => $function['signature'], 'startLine' => $function['startLine'], 'executableLines' => 0, 'executedLines' => 0, 'ccn' => $function['ccn']);
         $this->startLines[$function['startLine']] =& $this->classes['*']['methods'][$functionName];
         $this->endLines[$function['endLine']] =& $this->classes['*']['methods'][$functionName];
     }
 }
开发者ID:proofek,项目名称:php-code-coverage,代码行数:18,代码来源:File.php


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