Kylob/BootPress

View on GitHub

Showing 16,700 of 16,700 total issues

File Users.php has 396 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace BootPress\Admin\Pages;

use BootPress\Admin\Component as Admin;
Severity: Minor
Found in src/Admin/Pages/Users.php - About 5 hrs to fix

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

    <?php
    
    namespace BootPress\Auth;
    
    use BootPress\Page\Component as Page;
    Severity: Minor
    Found in src/Auth/Component.php - About 5 hrs to fix

      Method robots has 131 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function robots()
          {
              extract(Admin::params('bp', 'blog', 'website', 'page'));
              $page->title = 'Robot Analytics at '.$website;
              $html = '';
      Severity: Major
      Found in src/Admin/Pages/Analytics.php - About 5 hrs to fix

        Method __construct has 128 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function __construct(array $options = array())
            {
                extract(array_merge(array(
                    'db' => null,
                    'basic' => null,
        Severity: Major
        Found in src/Auth/Component.php - About 5 hrs to fix

          Function log has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function log()
              {
                  // Get initial values
                  $page = Page::html();
                  $log = array(); // csv lines
          Severity: Minor
          Found in src/Analytics/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 visitors has 127 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function visitors()
              {
                  extract(Admin::params('bp', 'website', 'page', 'path', 'admin'));
                  $page->title = 'Visitors at '.$website;
                  $html = '';
          Severity: Major
          Found in src/Admin/Pages/Analytics.php - About 5 hrs to fix

            Function save has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function save(array $files, array $remove = array())
                {
                    $page = Page::html();
                    if (($retrieve = $page->post('retrieve')) && isset($files[$retrieve])) {
                        exit(is_file($files[$retrieve]) ? file_get_contents($files[$retrieve]) : '');
            Severity: Minor
            Found in src/Admin/Files.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

            Function update has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

                public function update($user_id, array $user = array())
                {
                    $update = array();
                    foreach ($user as $key => $value) {
                        switch ($key) {
            Severity: Minor
            Found in src/Auth/Component.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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                                    'crc-32' => str_pad(dechex(ord($dir['crc-32'][3])), 2, '0', STR_PAD_LEFT).
                                    str_pad(dechex(ord($dir['crc-32'][2])), 2, '0', STR_PAD_LEFT).
                                    str_pad(dechex(ord($dir['crc-32'][1])), 2, '0', STR_PAD_LEFT).
                                    str_pad(dechex(ord($dir['crc-32'][0])), 2, '0', STR_PAD_LEFT),
            Severity: Major
            Found in src/Unzip/Component.php and 1 other location - About 4 hrs to fix
            src/Unzip/Component.php on lines 438..441

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 181.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                            'crc-32' => str_pad(dechex(ord($file['crc-32'][3])), 2, '0', STR_PAD_LEFT).
                            str_pad(dechex(ord($file['crc-32'][2])), 2, '0', STR_PAD_LEFT).
                            str_pad(dechex(ord($file['crc-32'][1])), 2, '0', STR_PAD_LEFT).
                            str_pad(dechex(ord($file['crc-32'][0])), 2, '0', STR_PAD_LEFT),
            Severity: Major
            Found in src/Unzip/Component.php and 1 other location - About 4 hrs to fix
            src/Unzip/Component.php on lines 327..330

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 181.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Method theme has 118 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static function theme($folder)
                {
                    extract(Admin::params('bp', 'page', 'blog'));
                    if ($page->get('delete') == 'theme') {
                        list($dirs, $files) = Files::iterate($folder, 'recursive');
            Severity: Major
            Found in src/Admin/Pages/Themes.php - About 4 hrs to fix

              Method __construct has 115 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function __construct(array $enable = array(), array $messages = array())
                  {
                      if (self::$debugbar) {
                          return;
                      }
              Severity: Major
              Found in src/DebugBar/Component.php - About 4 hrs to fix

                Function robots has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function robots()
                    {
                        extract(Admin::params('bp', 'blog', 'website', 'page'));
                        $page->title = 'Robot Analytics at '.$website;
                        $html = '';
                Severity: Minor
                Found in src/Admin/Pages/Analytics.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 image has 114 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private static function image($path, $eject = '')
                    {
                        $html = '';
                        $imagick = (extension_loaded('imagick') && class_exists('Imagick')) ? true : false;
                        $types = array('jpg', 'gif', 'png');
                Severity: Major
                Found in src/Admin/Files.php - About 4 hrs to fix

                  Method file has 107 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function file($field, array $options = array())
                      {
                          $page = Page::html();
                  
                          // View
                  Severity: Major
                  Found in src/Upload/Component.php - About 4 hrs to fix

                    Method location has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function location($timezone, $hemisphere = '')
                        {
                            static $timezones = array(
                                'UM12' => 'Baker / Howland Islands',
                                'UM11' => array(
                    Severity: Major
                    Found in src/Analytics/Component.php - About 4 hrs to fix

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

                      <?php
                      
                      namespace BootPress\Unzip;
                      
                      use BootPress\Page\Component as Page;
                      Severity: Minor
                      Found in src/Unzip/Component.php - About 4 hrs to fix

                        Function iterate has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function iterate($path, $recursive = false, $types = null)
                            {
                                $dirs = $files = array();
                                if (is_dir($path)) {
                                    $cut = strlen($path);
                        Severity: Minor
                        Found in src/Admin/Files.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 server has 97 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function server()
                            {
                                extract(Admin::params('bp', 'website', 'page'));
                                $page->title = 'Server Analytics at '.$website;
                                $page->link(array(
                        Severity: Major
                        Found in src/Admin/Pages/Analytics.php - About 3 hrs to fix

                          Method process has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static function process()
                              {
                                  $page = Page::html();
                                  $file = $page->file('analytics.csv');
                                  $temp = $page->file('analytics-temp.csv');
                          Severity: Major
                          Found in src/Analytics/Component.php - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language