You are here

protected function PHP_CodeCoverage_Report_Node_File::processTraits in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/phpunit/php-code-coverage/src/CodeCoverage/Report/Node/File.php \PHP_CodeCoverage_Report_Node_File::processTraits()

Parameters

PHP_Token_Stream $tokens:

1 call to PHP_CodeCoverage_Report_Node_File::processTraits()
PHP_CodeCoverage_Report_Node_File::calculateStatistics in vendor/phpunit/php-code-coverage/src/CodeCoverage/Report/Node/File.php
Calculates coverage statistics for the file.

File

vendor/phpunit/php-code-coverage/src/CodeCoverage/Report/Node/File.php, line 583

Class

PHP_CodeCoverage_Report_Node_File
Represents a file in the code coverage information tree.

Code

protected function processTraits(PHP_Token_Stream $tokens) {
  $traits = $tokens
    ->getTraits();
  unset($tokens);
  $link = $this
    ->getId() . '.html#';
  foreach ($traits as $traitName => $trait) {
    $this->traits[$traitName] = array(
      'traitName' => $traitName,
      'methods' => array(),
      'startLine' => $trait['startLine'],
      'executableLines' => 0,
      'executedLines' => 0,
      'ccn' => 0,
      'coverage' => 0,
      'crap' => 0,
      'package' => $trait['package'],
      'link' => $link . $trait['startLine'],
    );
    $this->startLines[$trait['startLine']] =& $this->traits[$traitName];
    $this->endLines[$trait['endLine']] =& $this->traits[$traitName];
    foreach ($trait['methods'] as $methodName => $method) {
      $this->traits[$traitName]['methods'][$methodName] = array(
        'methodName' => $methodName,
        'signature' => $method['signature'],
        'startLine' => $method['startLine'],
        'endLine' => $method['endLine'],
        'executableLines' => 0,
        'executedLines' => 0,
        'ccn' => $method['ccn'],
        'coverage' => 0,
        'crap' => 0,
        'link' => $link . $method['startLine'],
      );
      $this->startLines[$method['startLine']] =& $this->traits[$traitName]['methods'][$methodName];
      $this->endLines[$method['endLine']] =& $this->traits[$traitName]['methods'][$methodName];
    }
  }
}