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

Breadcrumb

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

function File::renderPathStructure

1 call to File::renderPathStructure()
File::render in vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php

File

vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php, line 844

Class

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

Namespace

SebastianBergmann\CodeCoverage\Report\Html

Code

private function renderPathStructure(FileNode $node) : string {
    $pathsTemplate = new Template($this->templatePath . 'paths.html.dist', '{{', '}}');
    $coverageData = $node->functionCoverageData();
    $testData = $node->testData();
    $codeLines = $this->loadFile($node->pathAsString());
    $paths = '';
    ksort($coverageData);
    foreach ($coverageData as $methodName => $methodData) {
        if (!$methodData['paths']) {
            continue;
        }
        $pathStructure = '';
        if (count($methodData['paths']) > 100) {
            $pathStructure .= '<p>' . count($methodData['paths']) . ' is too many paths to sensibly render, consider refactoring your code to bring this number down.</p>';
            continue;
        }
        foreach ($methodData['paths'] as $path) {
            $pathStructure .= $this->renderPathLines($path, $methodData['branches'], $codeLines, $testData);
        }
        if ($pathStructure !== '') {
            $paths .= '<h5 class="structure-heading"><a name="' . htmlspecialchars($methodName, $this->htmlSpecialCharsFlags) . '">' . $this->abbreviateMethodName($methodName) . '</a></h5>' . "\n";
            $paths .= $pathStructure;
        }
    }
    $pathsTemplate->setVar([
        'paths' => $paths,
    ]);
    return $pathsTemplate->render();
}

API Navigation

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