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


PHP PHP_Token_Stream类代码示例

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


在下文中一共展示了PHP_Token_Stream类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getLinesToBeIgnored

 /**
  * Returns the lines of a source file that should be ignored.
  *
  * @param  string                     $filename
  * @return array
  * @throws PHP_CodeCoverage_Exception
  * @since  Method available since Release 2.0.0
  */
 private function getLinesToBeIgnored($filename)
 {
     if (!is_string($filename)) {
         throw PHP_CodeCoverage_Util_InvalidArgumentHelper::factory(1, 'string');
     }
     if (!isset($this->ignoredLines[$filename])) {
         $this->ignoredLines[$filename] = array();
         $ignore = false;
         $stop = false;
         $lines = file($filename);
         $numLines = count($lines);
         foreach ($lines as $index => $line) {
             if (!trim($line)) {
                 $this->ignoredLines[$filename][] = $index + 1;
             }
         }
         if ($this->cacheTokens) {
             $tokens = PHP_Token_Stream_CachingFactory::get($filename);
         } else {
             $tokens = new PHP_Token_Stream($filename);
         }
         $classes = array_merge($tokens->getClasses(), $tokens->getTraits());
         $tokens = $tokens->tokens();
         foreach ($tokens as $token) {
             switch (get_class($token)) {
                 case 'PHP_Token_COMMENT':
                 case 'PHP_Token_DOC_COMMENT':
                     $_token = trim($token);
                     $_line = trim($lines[$token->getLine() - 1]);
                     if ($_token == '// @codeCoverageIgnore' || $_token == '//@codeCoverageIgnore') {
                         $ignore = true;
                         $stop = true;
                     } elseif ($_token == '// @codeCoverageIgnoreStart' || $_token == '//@codeCoverageIgnoreStart') {
                         $ignore = true;
                     } elseif ($_token == '// @codeCoverageIgnoreEnd' || $_token == '//@codeCoverageIgnoreEnd') {
                         $stop = true;
                     }
                     if (!$ignore) {
                         $start = $token->getLine();
                         $end = $start + substr_count($token, "\n");
                         // Do not ignore the first line when there is a token
                         // before the comment
                         if (0 !== strpos($_token, $_line)) {
                             $start++;
                         }
                         for ($i = $start; $i < $end; $i++) {
                             $this->ignoredLines[$filename][] = $i;
                         }
                         // A DOC_COMMENT token or a COMMENT token starting with "/*"
                         // does not contain the final \n character in its text
                         if (0 === strpos($_token, '/*') && '*/' === substr(trim($lines[$i - 1]), -2)) {
                             $this->ignoredLines[$filename][] = $i;
                         }
                     }
                     break;
                 case 'PHP_Token_INTERFACE':
                 case 'PHP_Token_TRAIT':
                 case 'PHP_Token_CLASS':
                 case 'PHP_Token_FUNCTION':
                     $docblock = $token->getDocblock();
                     $this->ignoredLines[$filename][] = $token->getLine();
                     if (strpos($docblock, '@codeCoverageIgnore')) {
                         $endLine = $token->getEndLine();
                         for ($i = $token->getLine(); $i <= $endLine; $i++) {
                             $this->ignoredLines[$filename][] = $i;
                         }
                     } elseif ($token instanceof PHP_Token_INTERFACE || $token instanceof PHP_Token_TRAIT || $token instanceof PHP_Token_CLASS) {
                         if (empty($classes[$token->getName()]['methods'])) {
                             for ($i = $token->getLine(); $i <= $token->getEndLine(); $i++) {
                                 $this->ignoredLines[$filename][] = $i;
                             }
                         } else {
                             $firstMethod = array_shift($classes[$token->getName()]['methods']);
                             do {
                                 $lastMethod = array_pop($classes[$token->getName()]['methods']);
                             } while ($lastMethod !== null && substr($lastMethod['signature'], 0, 18) == 'anonymous function');
                             if ($lastMethod === null) {
                                 $lastMethod = $firstMethod;
                             }
                             for ($i = $token->getLine(); $i < $firstMethod['startLine']; $i++) {
                                 $this->ignoredLines[$filename][] = $i;
                             }
                             for ($i = $token->getEndLine(); $i > $lastMethod['endLine']; $i--) {
                                 $this->ignoredLines[$filename][] = $i;
                             }
                         }
                     }
                     break;
                 case 'PHP_Token_NAMESPACE':
                     $this->ignoredLines[$filename][] = $token->getEndLine();
                     // Intentional fallthrough
                 // Intentional fallthrough
//.........这里部分代码省略.........
开发者ID:Ingothq,项目名称:multiarmedbandit,代码行数:101,代码来源:CodeCoverage.php

示例5: testIssue30

 public function testIssue30()
 {
     $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'issue30.php');
     $this->assertCount(1, $ts->getClasses());
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:5,代码来源:ClassTest.php

示例6: getLinesToBeIgnored

 /**
  * Returns the lines of a source file that should be ignored.
  *
  * @param  string  $filename
  * @param  boolean $cacheTokens
  * @return array
  * @throws PHP_CodeCoverage_Exception
  */
 public static function getLinesToBeIgnored($filename, $cacheTokens = TRUE)
 {
     if (!is_string($filename)) {
         throw PHP_CodeCoverage_Util_InvalidArgumentHelper::factory(1, 'string');
     }
     if (!is_bool($cacheTokens)) {
         throw PHP_CodeCoverage_Util_InvalidArgumentHelper::factory(2, 'boolean');
     }
     if (!isset(self::$ignoredLines[$filename])) {
         self::$ignoredLines[$filename] = array();
         $ignore = FALSE;
         $stop = FALSE;
         $lines = file($filename);
         foreach ($lines as $index => $line) {
             if (!trim($line)) {
                 self::$ignoredLines[$filename][$index + 1] = TRUE;
             }
         }
         if ($cacheTokens) {
             $tokens = PHP_Token_Stream_CachingFactory::get($filename);
         } else {
             $tokens = new PHP_Token_Stream($filename);
         }
         $classes = array_merge($tokens->getClasses(), $tokens->getTraits());
         $tokens = $tokens->tokens();
         foreach ($tokens as $token) {
             switch (get_class($token)) {
                 case 'PHP_Token_COMMENT':
                 case 'PHP_Token_DOC_COMMENT':
                     $count = substr_count($token, "\n");
                     $line = $token->getLine();
                     for ($i = $line; $i < $line + $count; $i++) {
                         self::$ignoredLines[$filename][$i] = TRUE;
                     }
                     if ($token instanceof PHP_Token_DOC_COMMENT) {
                         // Workaround for the fact the DOC_COMMENT token
                         // does not include the final \n character in its
                         // text.
                         if (substr(trim($lines[$i - 1]), -2) == '*/') {
                             self::$ignoredLines[$filename][$i] = TRUE;
                         }
                         break;
                     }
                     $_token = trim($token);
                     if ($_token == '// @codeCoverageIgnore' || $_token == '//@codeCoverageIgnore') {
                         $ignore = TRUE;
                         $stop = TRUE;
                     } else {
                         if ($_token == '// @codeCoverageIgnoreStart' || $_token == '//@codeCoverageIgnoreStart') {
                             $ignore = TRUE;
                         } else {
                             if ($_token == '// @codeCoverageIgnoreEnd' || $_token == '//@codeCoverageIgnoreEnd') {
                                 $stop = TRUE;
                             }
                         }
                     }
                     break;
                 case 'PHP_Token_INTERFACE':
                 case 'PHP_Token_TRAIT':
                 case 'PHP_Token_CLASS':
                 case 'PHP_Token_FUNCTION':
                     $docblock = $token->getDocblock();
                     if (strpos($docblock, '@codeCoverageIgnore')) {
                         $endLine = $token->getEndLine();
                         for ($i = $token->getLine(); $i <= $endLine; $i++) {
                             self::$ignoredLines[$filename][$i] = TRUE;
                         }
                     } else {
                         if ($token instanceof PHP_Token_INTERFACE || $token instanceof PHP_Token_TRAIT || $token instanceof PHP_Token_CLASS) {
                             if (empty($classes[$token->getName()]['methods'])) {
                                 for ($i = $token->getLine(); $i <= $token->getEndLine(); $i++) {
                                     self::$ignoredLines[$filename][$i] = TRUE;
                                 }
                             } else {
                                 $firstMethod = array_shift($classes[$token->getName()]['methods']);
                                 $lastMethod = array_pop($classes[$token->getName()]['methods']);
                                 if ($lastMethod === NULL) {
                                     $lastMethod = $firstMethod;
                                 }
                                 for ($i = $token->getLine(); $i < $firstMethod['startLine']; $i++) {
                                     self::$ignoredLines[$filename][$i] = TRUE;
                                 }
                                 for ($i = $token->getEndLine(); $i > $lastMethod['endLine']; $i--) {
                                     self::$ignoredLines[$filename][$i] = TRUE;
                                 }
                             }
                         }
                     }
                     break;
                 case 'PHP_Token_INTERFACE':
                     $endLine = $token->getEndLine();
                     for ($i = $token->getLine(); $i <= $endLine; $i++) {
//.........这里部分代码省略.........
开发者ID:shinichi81,项目名称:Codeigniter-TDD-with-Hooks,代码行数:101,代码来源:Util.php

示例7: getLinesToBeIgnored

 /**
  * Returns the lines of a source file that should be ignored.
  *
  * @param  string  $filename
  * @param  boolean $cacheTokens
  * @return array
  * @throws InvalidArgumentException
  */
 public static function getLinesToBeIgnored($filename, $cacheTokens = TRUE)
 {
     if (!is_bool($cacheTokens)) {
         throw new InvalidArgumentException();
     }
     if (!isset(self::$ignoredLines[$filename])) {
         self::$ignoredLines[$filename] = array();
         $ignore = FALSE;
         $stop = FALSE;
         if ($cacheTokens) {
             $tokens = PHP_Token_Stream_CachingFactory::get($filename);
         } else {
             $tokens = new PHP_Token_Stream($filename);
         }
         $classes = $tokens->getClasses();
         $tokens = $tokens->tokens();
         foreach ($tokens as $token) {
             switch (get_class($token)) {
                 case 'PHP_Token_CLASS':
                 case 'PHP_Token_FUNCTION':
                     $docblock = $token->getDocblock();
                     if (strpos($docblock, '@codeCoverageIgnore')) {
                         $endLine = $token->getEndLine();
                         for ($i = $token->getLine(); $i <= $endLine; $i++) {
                             self::$ignoredLines[$filename][$i] = TRUE;
                         }
                     } else {
                         if ($token instanceof PHP_Token_CLASS && !empty($classes[$token->getName()]['methods'])) {
                             $firstMethod = array_shift($classes[$token->getName()]['methods']);
                             for ($i = $token->getLine(); $i < $firstMethod['startLine']; $i++) {
                                 self::$ignoredLines[$filename][$i] = TRUE;
                             }
                         }
                     }
                     break;
                 case 'PHP_Token_COMMENT':
                     $_token = trim($token);
                     if ($_token == '// @codeCoverageIgnoreStart' || $_token == '//@codeCoverageIgnoreStart') {
                         $ignore = TRUE;
                     } else {
                         if ($_token == '// @codeCoverageIgnoreEnd' || $_token == '//@codeCoverageIgnoreEnd') {
                             $stop = TRUE;
                         }
                     }
                     break;
             }
             if ($ignore) {
                 self::$ignoredLines[$filename][$token->getLine()] = TRUE;
                 if ($stop) {
                     $ignore = FALSE;
                     $stop = FALSE;
                 }
             }
         }
     }
     return self::$ignoredLines[$filename];
 }
开发者ID:nbalonso,项目名称:MunkiFace,代码行数:65,代码来源:Util.php

示例8: testAnonymousClassesAreHandledCorrectly

 /**
  * @requires PHP 7
  */
 public function testAnonymousClassesAreHandledCorrectly()
 {
     $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'class_with_method_that_declares_anonymous_class.php');
     $classes = $ts->getClasses();
     $this->assertEquals(array('class_with_method_that_declares_anonymous_class'), array_keys($classes));
 }
开发者ID:ProgrammingPeter,项目名称:nba-schedule-api,代码行数:9,代码来源:ClassTest.php

示例9: 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

示例10: 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

示例11: 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

示例12: _getClassessInFile

 protected function _getClassessInFile($path)
 {
     if (version_compare(PHPUnit_Runner_Version::id(), '3.4', '<')) {
         $classes = array();
         foreach (PHPUnit_Util_Class::getClassesInFile($path) as $reflection) {
             $classes[] = $reflection->getName();
         }
         return $classes;
     } elseif (version_compare(PHPUnit_Runner_Version::id(), '3.7', '<')) {
         return array_keys(PHPUnit_Util_File::getClassesInFile($path));
     } else {
         $stream = new PHP_Token_Stream($path);
         return array_keys($stream->getClasses());
     }
 }
开发者ID:66Ton99,项目名称:sfPhpunitPlugin,代码行数:15,代码来源:sfPhpunitBaseTestLoader.php

示例13: die

#!/usr/bin/env php
<?php 
if (!file_exists(__DIR__ . '/../vendor/autoload.php')) {
    die('You need to set up the project dependencies using the following commands:' . PHP_EOL . 'wget https://getcomposer.org/composer.phar' . PHP_EOL . 'php composer.phar install' . PHP_EOL);
}
require __DIR__ . '/../vendor/autoload.php';
use SebastianBergmann\FinderFacade\FinderFacade;
$finder = new FinderFacade(array(__DIR__ . '/../example/src'), array(), array('*.php'));
print 'digraph G {' . PHP_EOL;
foreach ($finder->findFiles() as $file) {
    $file = new PHP_Token_Stream($file);
    foreach ($file->getClasses() as $className => $class) {
        if ($class['parent'] == 'AbstractDoorState') {
            foreach ($class['methods'] as $methodName => $method) {
                if (!in_array($methodName, array('open', 'close', 'lock', 'unlock'))) {
                    continue;
                }
                $annotations = array('return' => array());
                if (preg_match_all('/@(?P<name>[A-Za-z_-]+)(?:[ \\t]+(?P<value>.*?))?[ \\t]*\\r?$/m', $method['docblock'], $matches)) {
                    for ($i = 0; $i < count($matches[0]); ++$i) {
                        $annotations[$matches['name'][$i]][] = $matches['value'][$i];
                    }
                }
                foreach ($annotations['return'] as $return) {
                    printf('  "%s" -> "%s";' . PHP_EOL, str_replace(array('Door', 'State'), array(' Door', ''), $className), str_replace(array('Door', 'State'), array(' Door', ''), $return));
                }
            }
        }
    }
}
print '}' . PHP_EOL;
开发者ID:anis-marrouchi,项目名称:state,代码行数:31,代码来源:visualize.php

示例14: process

 /**
  * @param  PHP_CodeCoverage $coverage
  * @param  string           $target
  * @param  string           $name
  * @return string
  */
 public function process(PHP_CodeCoverage $coverage, $target = NULL, $name = NULL)
 {
     $document = new DOMDocument('1.0', 'UTF-8');
     $document->formatOutput = TRUE;
     $root = $document->createElement('coverage');
     $root->setAttribute('generated', (int) $_SERVER['REQUEST_TIME']);
     $document->appendChild($root);
     $project = $document->createElement('project');
     $project->setAttribute('timestamp', (int) $_SERVER['REQUEST_TIME']);
     if (is_string($name)) {
         $project->setAttribute('name', $name);
     }
     $root->appendChild($project);
     $files = $coverage->getData();
     $packages = array();
     $projectStatistics = array('files' => 0, 'loc' => 0, 'ncloc' => 0, 'classes' => 0, 'methods' => 0, 'coveredMethods' => 0, 'conditionals' => 0, 'coveredConditionals' => 0, 'statements' => 0, 'coveredStatements' => 0);
     foreach ($files as $filename => $data) {
         $namespace = 'global';
         if (file_exists($filename)) {
             $fileStatistics = array('classes' => 0, 'methods' => 0, 'coveredMethods' => 0, 'conditionals' => 0, 'coveredConditionals' => 0, 'statements' => 0, 'coveredStatements' => 0);
             $file = $document->createElement('file');
             $file->setAttribute('name', $filename);
             if ($this->cacheTokens) {
                 $tokens = PHP_Token_Stream_CachingFactory::get($filename);
             } else {
                 $tokens = new PHP_Token_Stream($filename);
             }
             $classesInFile = $tokens->getClasses();
             $linesOfCode = $tokens->getLinesOfCode();
             unset($tokens);
             $ignoredLines = PHP_CodeCoverage_Util::getLinesToBeIgnored($filename, $this->cacheTokens);
             $lines = array();
             foreach ($classesInFile as $className => $_class) {
                 $classStatistics = array('methods' => 0, 'coveredMethods' => 0, 'conditionals' => 0, 'coveredConditionals' => 0, 'statements' => 0, 'coveredStatements' => 0);
                 foreach ($_class['methods'] as $methodName => $method) {
                     $classStatistics['methods']++;
                     $methodCount = 0;
                     $methodLines = 0;
                     $methodLinesCovered = 0;
                     for ($i = $method['startLine']; $i <= $method['endLine']; $i++) {
                         if (isset($ignoredLines[$i])) {
                             continue;
                         }
                         $add = TRUE;
                         $count = 0;
                         if (isset($files[$filename][$i])) {
                             if ($files[$filename][$i] !== NULL) {
                                 $classStatistics['statements']++;
                                 $methodLines++;
                             } else {
                                 $add = FALSE;
                             }
                             $count = count($files[$filename][$i]);
                             if ($count > 0) {
                                 $classStatistics['coveredStatements']++;
                                 $methodLinesCovered++;
                             }
                         } else {
                             $add = FALSE;
                         }
                         $methodCount = max($methodCount, $count);
                         if ($add) {
                             $lines[$i] = array('count' => $count, 'type' => 'stmt');
                         }
                     }
                     if ($methodCount > 0) {
                         $classStatistics['coveredMethods']++;
                     }
                     $lines[$method['startLine']] = array('count' => $methodCount, 'crap' => PHP_CodeCoverage_Util::crap($method['ccn'], PHP_CodeCoverage_Util::percent($methodLinesCovered, $methodLines)), 'type' => 'method', 'name' => $methodName);
                 }
                 $package = PHP_CodeCoverage_Util::getPackageInformation($className, $_class['docblock']);
                 if (!empty($package['namespace'])) {
                     $namespace = $package['namespace'];
                 }
                 $class = $document->createElement('class');
                 $class->setAttribute('name', $className);
                 $class->setAttribute('namespace', $namespace);
                 if (!empty($package['fullPackage'])) {
                     $class->setAttribute('fullPackage', $package['fullPackage']);
                 }
                 if (!empty($package['category'])) {
                     $class->setAttribute('category', $package['category']);
                 }
                 if (!empty($package['package'])) {
                     $class->setAttribute('package', $package['package']);
                 }
                 if (!empty($package['subpackage'])) {
                     $class->setAttribute('subpackage', $package['subpackage']);
                 }
                 $file->appendChild($class);
                 $metrics = $document->createElement('metrics');
                 $metrics->setAttribute('methods', $classStatistics['methods']);
                 $metrics->setAttribute('coveredmethods', $classStatistics['coveredMethods']);
                 $metrics->setAttribute('conditionals', $classStatistics['conditionals']);
//.........这里部分代码省略.........
开发者ID:proofek,项目名称:php-code-coverage,代码行数:101,代码来源:Clover.php


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