pinpie/pinpie

View on GitHub
src/PP.php

Summary

Maintainability
D
1 day
Test Coverage

File PP.php has 309 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace pinpie\pinpie;

use mageekguy\atoum\asserters\boolean;
Severity: Minor
Found in src/PP.php - About 3 hrs to fix

    Function reportTags has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public function reportTags() {
            if (!$this->conf->debug) {
                return false;
            }
            ob_start();
    Severity: Minor
    Found in src/PP.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

    Method reportTags has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function reportTags() {
            if (!$this->conf->debug) {
                return false;
            }
            ob_start();
    Severity: Minor
    Found in src/PP.php - About 1 hr to fix

      Function getHashURL has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getHashURL() {
              if ($this->hashURL !== false) {
                  return $this->hashURL;
              }
              $code = http_response_code();
      Severity: Minor
      Found in src/PP.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

      Method parseString has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function parseString($content, $parent = null) {
              if (empty($parent)) {
                  $this->tagPath[] = '/';
              } else {
                  $this->tagPath[] = $parent->type . $parent->name;
      Severity: Minor
      Found in src/PP.php - About 1 hr to fix

        Method getHashURL has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getHashURL() {
                if ($this->hashURL !== false) {
                    return $this->hashURL;
                }
                $code = http_response_code();
        Severity: Minor
        Found in src/PP.php - About 1 hr to fix

          Method report has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function report() {
                  if (!$this->conf->debug) {
                      return false;
                  }
                  ob_start();
          Severity: Minor
          Found in src/PP.php - About 1 hr to fix

            Method createTag has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function createTag($matches, $parent) {
                    /* $matches
                     * Tag with new line after tag
                        array (size=8)
                            0 => string '[header[!$snippet]template]
            Severity: Minor
            Found in src/PP.php - About 1 hr to fix

              Function report has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function report() {
                      if (!$this->conf->debug) {
                          return false;
                      }
                      ob_start();
              Severity: Minor
              Found in src/PP.php - About 35 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

              Avoid too many return statements within this method.
              Open

                      return $pathRealpath;
              Severity: Major
              Found in src/PP.php - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status