PHPOffice/PHPPresentation

View on GitHub
samples/Sample_Header.php

Summary

Maintainability
F
3 days
Test Coverage

Function displayShapeInfo has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
Open

    protected function displayShapeInfo(AbstractShape $oShape): void
    {
        $this->append('<div class="infoBlk" id="div' . $oShape->getHashCode() . 'Info">');
        $this->append('<dl>');
        $this->append('<dt>HashCode</dt><dd>' . $oShape->getHashCode() . '</dd>');
Severity: Minor
Found in samples/Sample_Header.php - About 7 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File Sample_Header.php has 449 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Header file.
 */
use PhpOffice\PhpPresentation\AbstractShape;
Severity: Minor
Found in samples/Sample_Header.php - About 6 hrs to fix

    Method displayShapeInfo has 108 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function displayShapeInfo(AbstractShape $oShape): void
        {
            $this->append('<div class="infoBlk" id="div' . $oShape->getHashCode() . 'Info">');
            $this->append('<dl>');
            $this->append('<dt>HashCode</dt><dd>' . $oShape->getHashCode() . '</dd>');
    Severity: Major
    Found in samples/Sample_Header.php - About 4 hrs to fix

      Function displayPhpPresentationInfo has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function displayPhpPresentationInfo(PhpPresentation $oPHPPpt): void
          {
              $this->append('<div class="infoBlk" id="divPhpPresentationInfo">');
              $this->append('<dl>');
              $this->append('<dt>Number of slides</dt><dd>' . $oPHPPpt->getSlideCount() . '</dd>');
      Severity: Minor
      Found in samples/Sample_Header.php - About 4 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method displayPhpPresentationInfo has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function displayPhpPresentationInfo(PhpPresentation $oPHPPpt): void
          {
              $this->append('<div class="infoBlk" id="divPhpPresentationInfo">');
              $this->append('<dl>');
              $this->append('<dt>Number of slides</dt><dd>' . $oPHPPpt->getSlideCount() . '</dd>');
      Severity: Major
      Found in samples/Sample_Header.php - About 2 hrs to fix

        Function getEndingNotes has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        function getEndingNotes($writers)
        {
            $result = '';
        
            // Do not show execution time for index
        Severity: Minor
        Found in samples/Sample_Header.php - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function displayPhpPresentation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function displayPhpPresentation(PhpPresentation $oPHPPpt): void
            {
                $this->append('<li><span><i class="fa fa-folder-open"></i> PhpPresentation</span>');
                $this->append('<ul>');
                $this->append('<li><span class="shape" id="divPhpPresentation"><i class="fa fa-info-circle"></i> Info "PhpPresentation"</span></li>');
        Severity: Minor
        Found in samples/Sample_Header.php - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function getConstantName has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function getConstantName($class, $search, $startWith = '')
            {
                $fooClass = new ReflectionClass($class);
                $constants = $fooClass->getConstants();
                $constName = null;
        Severity: Minor
        Found in samples/Sample_Header.php - About 55 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function displayShape has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function displayShape(AbstractShape $shape): void
            {
                if ($shape instanceof Drawing\Gd) {
                    $this->append('<li><span class="shape" id="div' . $shape->getHashCode() . '">Shape "Drawing\Gd"</span></li>');
                } elseif ($shape instanceof Drawing\File) {
        Severity: Minor
        Found in samples/Sample_Header.php - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        There are no issues that match your filters.

        Category
        Status