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

Breadcrumb

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

function File::renderBranchStructure

1 call to File::renderBranchStructure()
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 744

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 renderBranchStructure(FileNode $node) : string {
    $branchesTemplate = new Template($this->templatePath . 'branches.html.dist', '{{', '}}');
    $coverageData = $node->functionCoverageData();
    $testData = $node->testData();
    $codeLines = $this->loadFile($node->pathAsString());
    $branches = '';
    ksort($coverageData);
    foreach ($coverageData as $methodName => $methodData) {
        if (!$methodData['branches']) {
            continue;
        }
        $branchStructure = '';
        foreach ($methodData['branches'] as $branch) {
            $branchStructure .= $this->renderBranchLines($branch, $codeLines, $testData);
        }
        if ($branchStructure !== '') {
            // don't show empty branches
            $branches .= '<h5 class="structure-heading"><a name="' . htmlspecialchars($methodName, $this->htmlSpecialCharsFlags) . '">' . $this->abbreviateMethodName($methodName) . '</a></h5>' . "\n";
            $branches .= $branchStructure;
        }
    }
    $branchesTemplate->setVar([
        'branches' => $branches,
    ]);
    return $branchesTemplate->render();
}

API Navigation

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