Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. File.php

function File::processFunctions

@psalm-param array<string, CodeUnitFunctionType> $functions

1 call to File::processFunctions()
File::calculateStatistics in vendor/phpunit/php-code-coverage/src/Node/File.php
@psalm-param array<string, CodeUnitClassType> $classes @psalm-param array<string, CodeUnitTraitType> $traits @psalm-param array<string, CodeUnitFunctionType> $functions

File

vendor/phpunit/php-code-coverage/src/Node/File.php, line 561

Class

File
@internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage

Namespace

SebastianBergmann\CodeCoverage\Node

Code

private function processFunctions(array $functions) : void {
    $link = $this->id() . '.html#';
    foreach ($functions as $functionName => $function) {
        $this->functions[$functionName] = [
            'functionName' => $functionName,
            'namespace' => $function['namespace'],
            'signature' => $function['signature'],
            'startLine' => $function['startLine'],
            'endLine' => $function['endLine'],
            'executableLines' => 0,
            'executedLines' => 0,
            'executableBranches' => 0,
            'executedBranches' => 0,
            'executablePaths' => 0,
            'executedPaths' => 0,
            'ccn' => $function['ccn'],
            'coverage' => 0,
            'crap' => 0,
            'link' => $link . $function['startLine'],
        ];
        foreach (range($function['startLine'], $function['endLine']) as $lineNumber) {
            $this->codeUnitsByLine[$lineNumber] = [
                &$this->functions[$functionName],
            ];
        }
        if (isset($this->functionCoverageData[$functionName]['branches'])) {
            $this->functions[$functionName]['executableBranches'] = count($this->functionCoverageData[$functionName]['branches']);
            $this->functions[$functionName]['executedBranches'] = count(array_filter($this->functionCoverageData[$functionName]['branches'], static function (array $branch) {
                return (bool) $branch['hit'];
            }));
        }
        if (isset($this->functionCoverageData[$functionName]['paths'])) {
            $this->functions[$functionName]['executablePaths'] = count($this->functionCoverageData[$functionName]['paths']);
            $this->functions[$functionName]['executedPaths'] = count(array_filter($this->functionCoverageData[$functionName]['paths'], static function (array $path) {
                return (bool) $path['hit'];
            }));
        }
        $this->numExecutableBranches += $this->functions[$functionName]['executableBranches'];
        $this->numExecutedBranches += $this->functions[$functionName]['executedBranches'];
        $this->numExecutablePaths += $this->functions[$functionName]['executablePaths'];
        $this->numExecutedPaths += $this->functions[$functionName]['executedPaths'];
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal