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

Breadcrumb

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

function File::newMethod

@psalm-param CodeUnitMethodType $method

@psalm-return ProcessedMethodType

2 calls to File::newMethod()
File::processClasses in vendor/phpunit/php-code-coverage/src/Node/File.php
@psalm-param array<string, CodeUnitClassType> $classes
File::processTraits in vendor/phpunit/php-code-coverage/src/Node/File.php
@psalm-param array<string, CodeUnitTraitType> $traits

File

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

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 newMethod(string $className, string $methodName, array $method, string $link) : array {
    $methodData = [
        'methodName' => $methodName,
        'visibility' => $method['visibility'],
        'signature' => $method['signature'],
        'startLine' => $method['startLine'],
        'endLine' => $method['endLine'],
        'executableLines' => 0,
        'executedLines' => 0,
        'executableBranches' => 0,
        'executedBranches' => 0,
        'executablePaths' => 0,
        'executedPaths' => 0,
        'ccn' => $method['ccn'],
        'coverage' => 0,
        'crap' => 0,
        'link' => $link . $method['startLine'],
    ];
    $key = $className . '->' . $methodName;
    if (isset($this->functionCoverageData[$key]['branches'])) {
        $methodData['executableBranches'] = count($this->functionCoverageData[$key]['branches']);
        $methodData['executedBranches'] = count(array_filter($this->functionCoverageData[$key]['branches'], static function (array $branch) {
            return (bool) $branch['hit'];
        }));
    }
    if (isset($this->functionCoverageData[$key]['paths'])) {
        $methodData['executablePaths'] = count($this->functionCoverageData[$key]['paths']);
        $methodData['executedPaths'] = count(array_filter($this->functionCoverageData[$key]['paths'], static function (array $path) {
            return (bool) $path['hit'];
        }));
    }
    return $methodData;
}

API Navigation

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