strata-mvc/strata

View on GitHub

Showing 146 of 158 total issues

Method input has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function input($name, $options = array())
    {
        $options += array(
            "type"  => "text",
            "id"    => $this->id($name),
Severity: Minor
Found in src/View/Helper/FormHelper.php - About 1 hr to fix

    Method combine has 49 lines of code (exceeds 25 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 1 hr to fix

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

          public static function normalize(array $data, $assoc = true)
          {
              $keys = array_keys($data);
              $count = count($keys);
              $numeric = true;
      Severity: Minor
      Found in src/Utility/Hash.php - About 1 hr 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 remove has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function remove(array $data, $path)
          {
              if (strpos($path, '[') === false) {
                  $tokens = explode('.', $path);
              } else {
      Severity: Minor
      Found in src/Utility/Hash.php - About 1 hr 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 registerTaxonomy has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function registerTaxonomy(Taxonomy $taxonomy)
          {
              $labelParser = new LabelParser($taxonomy);
              $labelParser->parse();
              $singular   = $labelParser->singular();
      Severity: Minor
      Found in src/Model/CustomPostType/Registrar/TaxonomyRegistrar.php - About 1 hr to fix

        Method insert has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function insert($str, $data, $options = array())
            {
                $defaults = array(
                    'before' => ':', 'after' => null, 'escape' => '\\', 'format' => null, 'clean' => false
                );
        Severity: Minor
        Found in src/Utility/StringUtility.php - About 1 hr to fix

          Function test has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              public function test($value, $context)
              {
                  if ($this->hasConfig("if") && !is_null($this->getConfig("if"))) {
                      $request =  Strata::router()->getCurrentController()->request;
                      foreach ($this->getConfig("if") as $key => $expectedValue) {
          Severity: Minor
          Found in src/Model/Validator/RequiredValidator.php - About 1 hr 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 contains has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function contains(array $data, array $needle)
              {
                  if (empty($data) || empty($needle)) {
                      return false;
                  }
          Severity: Minor
          Found in src/Utility/Hash.php - About 1 hr 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 insert has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function insert(array $data, $path, $values = null)
              {
                  if (strpos($path, '[') === false) {
                      $tokens = explode('.', $path);
                  } else {
          Severity: Minor
          Found in src/Utility/Hash.php - About 1 hr 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 merge has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function merge(array $data, $merge)
              {
                  $args = array_slice(func_get_args(), 1);
                  $return = $data;
          
          
          Severity: Minor
          Found in src/Utility/Hash.php - About 1 hr 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 exportObject has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected static function exportObject($var, $depth = 1, $indent = 0)
              {
                  $out = '';
                  $props = [];
                  $className = get_class($var);
          Severity: Minor
          Found in src/Logger/Debugger.php - About 1 hr to fix

            Method _matches has 41 lines of code (exceeds 25 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 1 hr to fix

              Method scanThemeDirectories has 40 lines of code (exceeds 25 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 1 hr to fix

                Method register has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function register()
                    {
                        // Ensure the default options have been set.
                        $customizedOptions = $this->model->getConfiguration() + array(
                            'labels'              => array(),
                Severity: Minor
                Found in src/Model/CustomPostType/Registrar/CustomPostTypeRegistrar.php - About 1 hr to fix

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

                      public function save()
                      {
                          if ($this->isBound()) {
                  
                              if (!isset($this->post_type)) {
                  Severity: Minor
                  Found in src/Model/CustomPostType/ModelEntity.php - About 1 hr 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 singularize has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function singularize($word)
                      {
                          if (isset(self::$_cache['singularize'][$word])) {
                              return self::$_cache['singularize'][$word];
                          }
                  Severity: Minor
                  Found in src/Utility/Inflector.php - About 1 hr to fix

                    Function exportObject has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected static function exportObject($var, $depth = 1, $indent = 0)
                        {
                            $out = '';
                            $props = [];
                            $className = get_class($var);
                    Severity: Minor
                    Found in src/Logger/Debugger.php - About 1 hr 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 rrmdir has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function rrmdir($dir)
                        {
                            if (is_dir($dir)) {
                                $objects = scandir($dir);
                                foreach ($objects as $object) {
                    Severity: Minor
                    Found in src/Shell/Command/DocumentationCommand.php - About 1 hr 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 get has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function get(array $data, $path, $default = null)
                        {
                            if (empty($data) || $path === '' || $path === null) {
                                return $default;
                            }
                    Severity: Minor
                    Found in src/Utility/Hash.php - About 1 hr 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 extract has 35 lines of code (exceeds 25 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 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language