ecoco/magento_profiler

View on GitHub

Showing 84 of 241 total issues

File RequestDataCollector.php has 445 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Class Ecocode_Profiler_Model_Collector_RequestDataCollector
 */

    Ecocode_Profiler_Model_Collector_RequestDataCollector has 45 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Ecocode_Profiler_Model_Collector_RequestDataCollector
        extends Ecocode_Profiler_Model_Collector_AbstractDataCollector
    {
        protected $messages = [];
    
    

      Function loadRewrites has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

          public function loadRewrites()
          {
              if ($this->_rewrites === null) {
                  $files     = ['config.xml', 'development.xml'];
                  $prototype = $this->_rewriteTypes;
      Severity: Minor
      Found in app/code/community/Ecocode/Profiler/Helper/Rewrite.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

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

          private function sanitizeLogs($logs)
          {
              $errorContextById = [];
              $sanitizedLogs    = [];
      
      

      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

      Ecocode_Profiler_Model_Profile has 28 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Ecocode_Profiler_Model_Profile
      {
          protected $token;
      
          /**
      Severity: Minor
      Found in app/code/community/Ecocode/Profiler/Model/Profile.php - About 3 hrs to fix

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

            public function exportValue($value, $depth = 1, $deep = false)
            {
                if (is_object($value)) {
                    if ($value instanceof \DateTimeInterface) {
                        return sprintf('Object(%s) - %s', get_class($value), $value->format(\DateTime::ISO8601));
        Severity: Minor
        Found in app/code/community/Ecocode/Profiler/Helper/ValueExporter.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

        Ecocode_Profiler_Model_Collector_ConfigDataCollector has 24 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Ecocode_Profiler_Model_Collector_ConfigDataCollector
            extends Ecocode_Profiler_Model_Collector_AbstractDataCollector
        {
            /** @var Ecocode_Profiler_Helper_Data */
            protected $helper;

          Function find has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              public function find($ip, $url, $limit, $method, $start = null, $end = null, $statusCode = null)
              {
                  $file = $this->getIndexFilename();
          
                  if (!file_exists($file)) {
          Severity: Minor
          Found in app/code/community/Ecocode/Profiler/Model/Profiler/FileStorage.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

          Function collectEvents has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function collectEvents(Ecocode_Profiler_Model_AppDev $app)
              {
                  $eventList = $app->getFiredEvents();
                  $events    = [];
          
          

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

              public function write(Ecocode_Profiler_Model_Profile $profile)
              {
                  $file = $this->getFilename($profile->getToken());
          
                  $profileIndexed = is_file($file);
          Severity: Minor
          Found in app/code/community/Ecocode/Profiler/Model/Profiler/FileStorage.php - About 1 hr to fix

            Method exportValue has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function exportValue($value, $depth = 1, $deep = false)
                {
                    if (is_object($value)) {
                        if ($value instanceof \DateTimeInterface) {
                            return sprintf('Object(%s) - %s', get_class($value), $value->format(\DateTime::ISO8601));
            Severity: Minor
            Found in app/code/community/Ecocode/Profiler/Helper/ValueExporter.php - About 1 hr to fix

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

                  protected function renderNode($node, $prefix = '', $sibling = false)
                  {
                      if (!$node['parent_id']) {
                          $start = $node['name'];
                      } else {

              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 collectSessionData has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function collectSessionData()
                  {
                      $namespaceData  = [];
                      $storeData      = [];
                      $rawSessionData = $this->getRawSession();

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

                  public function collect(Mage_Core_Controller_Request_Http $request, Mage_Core_Controller_Response_Http $response, \Exception $exception = null)
                  {
                      $stats = [
                          'load'      => 0,
                          'loop_load' => 0,

                Method collectEvents has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function collectEvents(Ecocode_Profiler_Model_AppDev $app)
                    {
                        $eventList = $app->getFiredEvents();
                        $events    = [];
                
                

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

                      public function find($ip, $url, $limit, $method, $start = null, $end = null, $statusCode = null)
                      {
                          $file = $this->getIndexFilename();
                  
                          if (!file_exists($file)) {
                  Severity: Minor
                  Found in app/code/community/Ecocode/Profiler/Model/Profiler/FileStorage.php - About 1 hr to fix

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

                        public function collect(Mage_Core_Controller_Request_Http $request, Mage_Core_Controller_Response_Http $response, \Exception $exception = null)
                        {
                            $responseHeaders = $this->collectResponseHeaders($response);
                            // attributes are serialized and as they can be anything, they need to be converted to strings.
                            $requestAttributes = $this->collectRequestAttributes($request);

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

                          private function sanitizeLogs($logs)
                          {
                              $errorContextById = [];
                              $sanitizedLogs    = [];
                      
                      

                        Consider simplifying this complex logical expression.
                        Open

                                    if ($ip && false === strpos($csvIp, $ip) || $url && false === strpos($csvUrl, $url) || $method && false === strpos($csvMethod, $method) || $statusCode && false === strpos($csvStatusCode, $statusCode)) {
                                        continue;
                                    }
                        Severity: Critical
                        Found in app/code/community/Ecocode/Profiler/Model/Profiler/FileStorage.php - About 1 hr to fix

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

                              protected static function getCategory($timerName)
                              {
                                  if (isset(self::$sectionMap[$timerName])) {
                                      return self::CATEGORY_SECTION;
                                  }
                          Severity: Minor
                          Found in app/code/community/Ecocode/Profiler/overwrite/VarienProfiler.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language