dist/jate/modules/Router/Router.php

Summary

Maintainability
A
3 hrs
Test Coverage

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

    protected function pathSeeker( $_path, $_url ) {
      $urlLength = count($_url);
      $cont = 0;
      $variables = [];
      $pathLength = count($_path);
Severity: Minor
Found in dist/jate/modules/Router/Router.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 getPage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getPage() {
      $parameters = [];
      $pageSelected = null;
      foreach ($this->pages as $page) {
        $urlParameters = $this->pathSeeker(explode("/", $page[0]), $this->url);
Severity: Minor
Found in dist/jate/modules/Router/Router.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

Missing class import via use statement (line '10', column '19').
Open

        throw new JException("Parameter must be a string.");
Severity: Minor
Found in dist/jate/modules/Router/Router.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '11', column '24').
Open

      $jConfig   = new JConfig($_path);
Severity: Minor
Found in dist/jate/modules/Router/Router.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

The method __construct has a boolean flag argument $_urlCaseSensitive, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function __construct( $_path, $_urlCaseSensitive = false ) {
Severity: Minor
Found in dist/jate/modules/Router/Router.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Missing class import via use statement (line '12', column '24').
Open

      $server    = new ServerVars();
Severity: Minor
Found in dist/jate/modules/Router/Router.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Avoid unused local variables such as '$parameters'.
Open

      $parameters = [];
Severity: Minor
Found in dist/jate/modules/Router/Router.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

There are no issues that match your filters.

Category
Status