strata-mvc/strata

View on GitHub

Showing 146 of 158 total issues

Function truncate has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
Open

    public static function truncate($text, $length = 100, $options = array())
    {
        $defaults = array(
            'ellipsis' => '...', 'exact' => true, 'html' => false
        );
Severity: Minor
Found in src/Utility/StringUtility.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

File Hash.php has 679 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
Severity: Major
Found in src/Utility/Hash.php - About 1 day to fix

    File StringUtility.php has 485 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * String handling methods.
     *
     * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
    Severity: Minor
    Found in src/Utility/StringUtility.php - About 7 hrs to fix

      Function tokenize has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function tokenize($data, $separator = ',', $leftBound = '(', $rightBound = ')')
          {
              if (empty($data)) {
                  return array();
              }
      Severity: Minor
      Found in src/Utility/StringUtility.php - About 6 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

      File Inflector.php has 407 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
       * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
       *
      Severity: Minor
      Found in src/Utility/Inflector.php - About 5 hrs to fix

        ModelEntity has 39 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class ModelEntity
        {
            use StrataObjectTrait;
        
            /**
        Severity: Minor
        Found in src/Model/CustomPostType/ModelEntity.php - About 5 hrs to fix

          StrataContext has 38 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class StrataContext
          {
              static $reference;
          
              /**
          Severity: Minor
          Found in src/Core/StrataContext.php - About 5 hrs to fix

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

                public function saveWPGettextFunctions(array $functions, Translations $translations, $file = '')
                {
                    foreach ($this->getFunctions() as $function) {
                        list($name, $line, $args) = $function;
            
            
            Severity: Minor
            Found in src/I18n/WpPhpFunctionsScanner.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 setCurrentLocaleByContext has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
            Open

                public function setCurrentLocaleByContext()
                {
                    if (function_exists('apply_filters')) {
                        // Give a chance for plugins to override this decision
                        $locale = null;
            Severity: Minor
            Found in src/I18n/I18n.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

            i18n has 34 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class i18n
            {
                /**
                 * @var string The default text domain used buy the class
                 */
            Severity: Minor
            Found in src/I18n/I18n.php - About 4 hrs to fix

              Function _matches has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected static function _matches(array $data, $selector)
                  {
                      preg_match_all(
                          '/(\[ (?P<attr>[^=><!]+?) (\s* (?P<op>[><!]?[=]|[><]) \s* (?P<val>(?:\/.*?\/ | [^\]]+)) )? \])/x',
                          $selector,
              Severity: Minor
              Found in src/Utility/Hash.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 truncate has 99 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function truncate($text, $length = 100, $options = array())
                  {
                      $defaults = array(
                          'ellipsis' => '...', 'exact' => true, 'html' => false
                      );
              Severity: Major
              Found in src/Utility/StringUtility.php - About 3 hrs to fix

                File I18n.php has 329 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                namespace Strata\I18n;
                
                use Strata\Strata;
                Severity: Minor
                Found in src/I18n/I18n.php - About 3 hrs to fix

                  Function uuid has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function uuid()
                      {
                          $node = getenv('SERVER_ADDR');
                          if (strpos($node, ':') !== false) {
                              if (substr_count($node, '::')) {
                  Severity: Minor
                  Found in src/Utility/StringUtility.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

                  Query has 29 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Query
                  {
                      /**
                       * A list of WP_Query filters. Defaults to a list of published posts
                       * ordered by name alphabetically unpaged.
                  Severity: Minor
                  Found in src/Model/CustomPostType/Query.php - About 3 hrs to fix

                    Hash has 29 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Hash
                    {
                    
                        /**
                     * Get a single value specified by $path out of $data.
                    Severity: Minor
                    Found in src/Utility/Hash.php - About 3 hrs to fix

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

                          public static function combine(array $data, $keyPath, $valuePath = null, $groupPath = null)
                          {
                              if (empty($data)) {
                                  return array();
                              }
                      Severity: Minor
                      Found in src/Utility/Hash.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 extract has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function extract(array $data, $path)
                          {
                              if (empty($path)) {
                                  return $data;
                              }
                      Severity: Minor
                      Found in src/Utility/Hash.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 scanThemeDirectories has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function scanThemeDirectories($base)
                          {
                              $tree = array("themes" => array());
                      
                              $di = new \RecursiveDirectoryIterator($base);
                      Severity: Minor
                      Found in src/Shell/Command/DocumentationCommand.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 _simpleOp has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected static function _simpleOp($op, $data, $path, $values = null)
                          {
                              $_list =& $data;
                      
                              $count = count($path);
                      Severity: Minor
                      Found in src/Utility/Hash.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

                      Severity
                      Category
                      Status
                      Source
                      Language