strata-mvc/strata

View on GitHub

Showing 146 of 158 total issues

Function create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function create($last = false)
    {
        if (!file_exists($this->destination)) {
            $dir = dirname($this->destination);
            if (!is_dir($dir)) {
Severity: Minor
Found in src/Shell/Command/Generator/ClassWriter.php - About 35 mins 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 mergeDiff has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function mergeDiff(array $data, $compare)
    {
        if (empty($data) && !empty($compare)) {
            return $compare;
        }
Severity: Minor
Found in src/Utility/Hash.php - About 35 mins 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 parseObject has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function parseObject($model)
    {
        if (property_exists($model, "routed") && is_array($model->routed)) {
            if (array_key_exists("page_slug_regex", $model->routed)) {
                $this->model = $model;
Severity: Minor
Found in src/Router/Registrar/PageRouteMaker.php - About 35 mins 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 extractGettextStrings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function extractGettextStrings()
    {
        $translation = null;
        $translationObjects = array();
        $lookupDirectories = array(
Severity: Minor
Found in src/Shell/Command/I18nCommand.php - About 35 mins 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 cleanInsert has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function cleanInsert($str, $options)
    {
        $clean = $options['clean'];
        if (!$clean) {
            return $str;
Severity: Minor
Found in src/Utility/StringUtility.php - About 35 mins 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

Avoid too many return statements within this method.
Open

                return $this->setLocale($locale);
Severity: Major
Found in src/I18n/I18n.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return strtolower(gettype($var));
    Severity: Major
    Found in src/Logger/Debugger.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return 'resource';
      Severity: Major
      Found in src/Logger/Debugger.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return 'unknown';
        Severity: Major
        Found in src/Logger/Debugger.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return array_combine($keys, $vals);
          Severity: Major
          Found in src/Utility/Hash.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return $label . "\n" . $this->generateTextinput($options, $currentValue) . $errorHtml . "\n";
            Severity: Major
            Found in src/View/Helper/FormHelper.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return static::exportArray($var, $depth - 1, $indent + 1);
              Severity: Major
              Found in src/Logger/Debugger.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return 'integer';
                Severity: Major
                Found in src/Logger/Debugger.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return 'boolean';
                  Severity: Major
                  Found in src/Logger/Debugger.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return true;
                    Severity: Major
                    Found in src/Error/BaseErrorHandler.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return new CommandGenerator($this);
                      Severity: Major
                      Found in src/Shell/Command/GenerateCommand.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return static::exportObject($var, $depth - 1, $indent + 1);
                        Severity: Major
                        Found in src/Logger/Debugger.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                          return new TaxonomyGenerator($this);
                          Severity: Major
                          Found in src/Shell/Command/GenerateCommand.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                                    return $this->setLocale($locale);
                            Severity: Major
                            Found in src/I18n/I18n.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                              return new ValidatorGenerator($this);
                              Severity: Major
                              Found in src/Shell/Command/GenerateCommand.php - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language