strata-mvc/strata

View on GitHub

Showing 146 of 158 total issues

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

class Strata extends StrataContext
{
    use StrataConfigurableTrait;

    /**
Severity: Minor
Found in src/Strata.php - About 3 hrs to fix

    Consider simplifying this complex logical expression.
    Open

                if ($op === '=' && $val && $val[0] === '/') {
                    if (!preg_match($val, $prop)) {
                        return false;
                    }
                } elseif (($op === '=' && $prop != $val)
    Severity: Critical
    Found in src/Utility/Hash.php - About 3 hrs to fix

      Function rules has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function rules($type, $rules, $reset = false)
          {
              $var = '_' . $type;
      
              switch ($type) {
      Severity: Minor
      Found in src/Utility/Inflector.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

      File FormHelper.php has 294 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace Strata\View\Helper;
      
      use Strata\Model\ModelEntity;
      Severity: Minor
      Found in src/View/Helper/FormHelper.php - About 3 hrs to fix

        File ModelEntity.php has 291 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        namespace Strata\Model\CustomPostType;
        
        use Strata\Utility\Hash;
        Severity: Minor
        Found in src/Model/CustomPostType/ModelEntity.php - About 3 hrs to fix

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

              public static function expand($data, $separator = '.')
              {
                  $result = array();
          
                  $stack = array();
          Severity: Minor
          Found in src/Utility/Hash.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

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

          class Request
          {
              /**
               * A cache of the parsed GET values in the current request.
               * @var array
          Severity: Minor
          Found in src/Controller/Request.php - About 2 hrs to fix

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

            class UrlRoute extends Route
            {
                /**
                 * @var string The hidden key for dynamically defined callback functions.
                 */
            Severity: Minor
            Found in src/Router/RouteParser/Url/UrlRoute.php - About 2 hrs to fix

              Function debug has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  function debug()
                  {
                      if (!WP_DEBUG) {
                          return;
                      }
              Severity: Minor
              Found in src/Utility/Toolset.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 uuid has 62 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function uuid()
                  {
                      $node = getenv('SERVER_ADDR');
                      if (strpos($node, ':') !== false) {
                          if (substr_count($node, '::')) {
              Severity: Major
              Found in src/Utility/StringUtility.php - About 2 hrs to fix

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

                    public static function sort(array $data, $path, $dir = 'asc', $type = 'regular')
                    {
                        if (empty($data)) {
                            return array();
                        }
                Severity: Minor
                Found in src/Utility/Hash.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 tokenize has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function tokenize($data, $separator = ',', $leftBound = '(', $rightBound = ')')
                    {
                        if (empty($data)) {
                            return array();
                        }
                Severity: Major
                Found in src/Utility/StringUtility.php - About 2 hrs to fix

                  FormHelper has 22 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class FormHelper extends Helper
                  {
                      /**
                       * @var Strata\Controller\Request The active request
                       */
                  Severity: Minor
                  Found in src/View/Helper/FormHelper.php - About 2 hrs to fix

                    Method cleanInsert has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function cleanInsert($str, $options)
                        {
                            $clean = $options['clean'];
                            if (!$clean) {
                                return $str;
                    Severity: Major
                    Found in src/Utility/StringUtility.php - About 2 hrs to fix

                      Method saveWPGettextFunctions has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function saveWPGettextFunctions(array $functions, Translations $translations, $file = '')
                          {
                              foreach ($this->getFunctions() as $function) {
                                  list($name, $line, $args) = $function;
                      
                      
                      Severity: Major
                      Found in src/I18n/WpPhpFunctionsScanner.php - About 2 hrs to fix

                        Function wordWrap has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function wordWrap($text, $width = 72, $break = "\n", $cut = false)
                            {
                                if ($cut) {
                                    $parts = array();
                                    while (mb_strlen($text) > 0) {
                        Severity: Minor
                        Found in src/Utility/StringUtility.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 nest has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function nest(array $data, $options = array())
                            {
                                if (!$data) {
                                    return $data;
                                }
                        Severity: Minor
                        Found in src/Utility/Hash.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 nest has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function nest(array $data, $options = array())
                            {
                                if (!$data) {
                                    return $data;
                                }
                        Severity: Major
                        Found in src/Utility/Hash.php - About 2 hrs to fix

                          Method sort has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static function sort(array $data, $path, $dir = 'asc', $type = 'regular')
                              {
                                  if (empty($data)) {
                                      return array();
                                  }
                          Severity: Major
                          Found in src/Utility/Hash.php - About 2 hrs to fix

                            Method setCurrentLocaleByContext has 49 lines of code (exceeds 25 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 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language