pinpie/pinpie

View on GitHub

Showing 40 of 40 total issues

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

    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 getDefaults has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getDefaults() {
              $cache = []; // Settings for current cacher
              $other = []; // You can put some custom setting here
              $databases = []; // To store database settings
              $debug = false; // Enables PinPIE::report() output. You can use it to enable your own debug mode. Globally available through PinPIE::$conf->debug.
      Severity: Major
      Found in src/Config.php - About 2 hrs to fix

        File Tag.php has 260 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        namespace pinpie\pinpie\Tags;
        
        use \pinpie\pinpie;
        Severity: Minor
        Found in src/Tags/Tag.php - About 2 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 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function __construct(PP $pinpie, $settings, $fulltag, $type, $placeholder, $template, $cachetime, $fullname, Tag $parentTag = null, $priority = 10000, $depth = 0) {
                  $this->time = [
                      'start' => microtime(true),
                      'end' => (float)0,
                      'total' => (float)0,
          Severity: Minor
          Found in src/Tags/Tag.php - About 2 hrs to fix

            Method replacePlaceholdersRecursive has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function replacePlaceholdersRecursive($content, &$depth) {
                    $depth--;
                    if (!$depth) {
                        $this->error('Max depth reached while calling replacePlaceholdersRecursive()');
                        return '';
            Severity: Minor
            Found in src/Tags/Tag.php - About 1 hr to fix

              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 findFile has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function findFile($url) {
                        $this->findPageFileRecur++;
                        if ($this->findPageFileRecur > $this->pinpie->conf->pinpie['route to parent']) {
                            return false;
                        }
                Severity: Minor
                Found in src/URL.php - About 1 hr to fix

                  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/Tag.php - About 1 hr to fix

                    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 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 draw has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              protected function draw() {
                                $content = '';
                                $this->filetime = filemtime($this->filename);
                                if (!$this->cachetime OR $this->cachebleParents) {
                                  //стоит запрет кеширования или не нужно кешировать, если один из родителей будет закеширован
                            Severity: Minor
                            Found in src/Tags/Snippet.php - About 1 hr to fix

                              Function findFile has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  protected function findFile($url) {
                                      $this->findPageFileRecur++;
                                      if ($this->findPageFileRecur > $this->pinpie->conf->pinpie['route to parent']) {
                                          return false;
                                      }
                              Severity: Minor
                              Found in src/URL.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 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

                                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
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language