pinpie/pinpie

View on GitHub
src/Tags/Staticon.php

Summary

Maintainability
D
1 day
Test Coverage

File Staticon.php has 318 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace pinpie\pinpie\Tags;

use \pinpie\pinpie\PP as PP;
Severity: Minor
Found in src/Tags/Staticon.php - About 3 hrs to fix

    Function checkAndRunGzip has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function checkAndRunGzip() {
            $r = false;
            if (!$this->checkMTime($this->filename, $this->filename . '.gz')) {
                $this->pinpie->times[] = [microtime(true), '#gzipping start ' . $this->filename];
                if (is_file($this->filename)) {
    Severity: Minor
    Found in src/Tags/Staticon.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 __construct has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function __construct(PP $pinpie, $settings, $fulltag, $type, $placeholder, $template, $cachetime, $fullname, Tag $parentTag = null, $priority = 10000, $depth = 0) {
    Severity: Major
    Found in src/Tags/Staticon.php - About 1 hr to fix

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

          public function getContent() {
              $this->pinpie->times[] = [microtime(true), 'getContent'];
              if (!empty($this->settings['draw function'])) {
                  $this->content = $this->settings['draw function']($this);
                  $this->pinpie->times[] = [microtime(true), 'drawn by func'];
      Severity: Minor
      Found in src/Tags/Staticon.php - About 1 hr to fix

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

            protected function getMinified() {
                $this->pinpie->times[] = [microtime(true), 'getMinified'];
                if (!isset($this->c['getMinified'])) {
                    $this->c['getMinified'] = [];
                }
        Severity: Minor
        Found in src/Tags/Staticon.php - About 1 hr to fix

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

              protected function getMinified() {
                  $this->pinpie->times[] = [microtime(true), 'getMinified'];
                  if (!isset($this->c['getMinified'])) {
                      $this->c['getMinified'] = [];
                  }
          Severity: Minor
          Found in src/Tags/Staticon.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 getContent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getContent() {
                  $this->pinpie->times[] = [microtime(true), 'getContent'];
                  if (!empty($this->settings['draw function'])) {
                      $this->content = $this->settings['draw function']($this);
                      $this->pinpie->times[] = [microtime(true), 'drawn by func'];
          Severity: Minor
          Found in src/Tags/Staticon.php - About 45 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 getStaticPathReal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function getStaticPathReal() {
                  $path = rtrim($this->settings['folder'], '/\\') . DIRECTORY_SEPARATOR . ltrim($this->staticPath, '/\\');
                  $this->pinpie->times[] = [microtime(true), 'processing static path ' . $path];
                  if ($this->settings['realpath check']) {
                      $this->pinpie->times[] = [microtime(true), 'realpath check required'];
          Severity: Minor
          Found in src/Tags/Staticon.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 false;
          Severity: Major
          Found in src/Tags/Staticon.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return '';
            Severity: Major
            Found in src/Tags/Staticon.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return $this->checkMTime($this->filename, $this->minifiedPath);
              Severity: Major
              Found in src/Tags/Staticon.php - About 30 mins to fix

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

                    public function getStaticUrl() {
                        if ($this->staticPath === '' OR $this->staticPath === false OR $this->staticPath === null) {
                            return false;
                        }
                        if (!isset($this->c['getStaticUrl'])) {
                Severity: Minor
                Found in src/Tags/Staticon.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