Showing 18 of 18 total issues

File Component.php has 614 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace BootPress\Asset;

use BootPress\Page\Component as Page;
Severity: Major
Found in src/Component.php - About 1 day to fix

    Function cached has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function cached($dir, array $glide = array())
        {
            $page = Page::html();
            static::$instance = new static();
            $asset = static::$instance;
    Severity: Minor
    Found in src/Component.php - About 1 day 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 mime has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function mime($type)
        {
            $mime = null;
            $single = (is_array($type)) ? false : true;
            if (is_array($type)) {
    Severity: Minor
    Found in src/Component.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

    Method mime has 143 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function mime($type)
        {
            $mime = null;
            $single = (is_array($type)) ? false : true;
            if (is_array($type)) {
    Severity: Major
    Found in src/Component.php - About 5 hrs to fix

      Function urls has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function urls($html)
          {
              if (is_null(static::$instance) || empty($html)) {
                  return $html;
              }
      Severity: Minor
      Found in src/Component.php - About 5 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 cached has 110 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function cached($dir, array $glide = array())
          {
              $page = Page::html();
              static::$instance = new static();
              $asset = static::$instance;
      Severity: Major
      Found in src/Component.php - About 4 hrs to fix

        Method urls has 89 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function urls($html)
            {
                if (is_null(static::$instance) || empty($html)) {
                    return $html;
                }
        Severity: Major
        Found in src/Component.php - About 3 hrs to fix

          Function paths has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              private function paths(&$cache)
              {
                  $page = Page::html();
                  $count = 0;
                  foreach ($cache as $dir => $files) {
          Severity: Minor
          Found in src/Component.php - About 3 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 css has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

              private function css($file, $row)
              {
                  $page = Page::html();
                  $css = file_get_contents($file);
                  if (substr($css, 0, 3) == "\xef\xbb\xbf") {
          Severity: Minor
          Found in src/Component.php - About 3 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 dispatch has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function dispatch($file, $options = array())
              {
                  $set = array_merge(array(
                      'name' => '',
                      'expires' => 0,
          Severity: Minor
          Found in src/Component.php - About 3 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 dispatch has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function dispatch($file, $options = array())
              {
                  $set = array_merge(array(
                      'name' => '',
                      'expires' => 0,
          Severity: Major
          Found in src/Component.php - About 2 hrs to fix

            Method paths has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function paths(&$cache)
                {
                    $page = Page::html();
                    $count = 0;
                    foreach ($cache as $dir => $files) {
            Severity: Major
            Found in src/Component.php - About 2 hrs to fix

              Method css has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function css($file, $row)
                  {
                      $page = Page::html();
                      $css = file_get_contents($file);
                      if (substr($css, 0, 3) == "\xef\xbb\xbf") {
              Severity: Minor
              Found in src/Component.php - About 1 hr to fix

                Method ids has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function ids($count)
                    {
                        $ids = array();
                        if ($stmt = $this->db->query(array(
                            'SELECT id, tiny',
                Severity: Minor
                Found in src/Component.php - About 1 hr to fix

                  Avoid deeply nested control flow statements.
                  Open

                                              if (is_file($row['file'])) {
                                                  $minify[$row['file']] = $row;
                                              }
                  Severity: Major
                  Found in src/Component.php - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                if (!empty($row['query'])) {
                                                    $source = $page->dir();
                                                    $image = substr($row['file'], strlen($source));
                                                    parse_str($row['query'], $params);
                                                    $setup = $glide;
                    Severity: Major
                    Found in src/Component.php - About 45 mins to fix

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

                          private function ids($count)
                          {
                              $ids = array();
                              if ($stmt = $this->db->query(array(
                                  'SELECT id, tiny',
                      Severity: Minor
                      Found in src/Component.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 $response;
                      Severity: Major
                      Found in src/Component.php - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language