jasonsnider/tinker-mvc

View on GitHub

Showing 40 of 40 total issues

Function checkAsset has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkAsset($loader)
    {
        //The plugin name as it appears on the servers file path
        $plugin = $this->getPlugin(true);

Severity: Minor
Found in core/Tinker/src/Mvc/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

Method __construct has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __construct($loader, $router, $theme, $view, $render = true) {

        $this->Loader = $loader;
        $this->Router = $router;
        $this->Theme = $theme;
Severity: Minor
Found in core/Tinker/src/Mvc/Dispatcher.php - About 1 hr to fix

Function render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function render($view)
    {
        $file = null;
        $theme = $this->getTheme();
        $layout = $this->getLayout();
Severity: Minor
Found in core/Tinker/src/Mvc/Theme.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 setViewPath has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function setViewPath()
    {
        $plugin = $this->Router->getPlugin(true);
        $controller = $this->Router->getController();
        $action = $this->Router->getAction();
Severity: Minor
Found in core/Tinker/src/Mvc/View.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 render has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function render($view)
    {
        $file = null;
        $theme = $this->getTheme();
        $layout = $this->getLayout();
Severity: Minor
Found in core/Tinker/src/Mvc/Theme.php - About 1 hr to fix

Method parseUri has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function parseUri($requestUri)
    {
        //Parse each URI segment into it's own element then remove all elements
        //with an empty value.
        $uriSegments = array_filter(explode('/', $requestUri));
Severity: Minor
Found in core/Tinker/src/Mvc/Router.php - About 1 hr to fix

Function __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct($loader, $router, $theme, $view, $render = true) {

        $this->Loader = $loader;
        $this->Router = $router;
        $this->Theme = $theme;
Severity: Minor
Found in core/Tinker/src/Mvc/Dispatcher.php - About 45 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

Similar blocks of code found in 3 locations. Consider refactoring.
Open

            if (is_file($check)) {
                $file = $check;
            } else {
                //If the literal path does not resolve, check against the include
                //paths
Severity: Minor
Found in core/Tinker/src/Mvc/Theme.php and 2 other locations - About 40 mins to fix
core/Tinker/src/Mvc/Router.php on lines 146..157
core/Tinker/src/Mvc/View.php on lines 62..73

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

            if (is_file($check)) {
                $file = $check;
            } else {
                //If the literal path does not resolve, check against the include
                //paths
Severity: Minor
Found in core/Tinker/src/Mvc/View.php and 2 other locations - About 40 mins to fix
core/Tinker/src/Mvc/Router.php on lines 146..157
core/Tinker/src/Mvc/Theme.php on lines 165..176

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

                if (is_file($check)) {
                    $asset = $check;
                } else {
                    //If the literal path does not resolve, check against the include
                    //paths
Severity: Minor
Found in core/Tinker/src/Mvc/Router.php and 2 other locations - About 40 mins to fix
core/Tinker/src/Mvc/Theme.php on lines 165..176
core/Tinker/src/Mvc/View.php on lines 62..73

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function __construct($loader, $router, $theme, $view, $render = true) {
Severity: Minor
Found in core/Tinker/src/Mvc/Dispatcher.php - About 35 mins to fix

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

    public function fetchAsset($asset)
    {

        //If the request is a real file from the requested plugin
        if (is_file($asset)) {
Severity: Minor
Found in core/Tinker/src/Mvc/Router.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

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

    public function addNamespace($prefix, $baseDir, $prepend = false)
Severity: Minor
Found in core/vendor/PhpFig/src/Loader.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 '50', column '32').
Open

        $reflectionClass = new \ReflectionClass($object);
Severity: Minor
Found in core/Tinker/src/Mvc/Controller.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 getController has a boolean flag argument $studlyCaps, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getController($studlyCaps = false)
Severity: Minor
Found in core/Tinker/src/Mvc/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

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

    public function getPlugin($studlyCaps = false)
Severity: Minor
Found in core/Tinker/src/Mvc/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 '28', column '19').
Open

        throw new \Exception(
Severity: Minor
Found in core/Tinker/src/Configure.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 getPlugin has a boolean flag argument $studlyCaps, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getPlugin($studlyCaps = false);

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 '94', column '19').
Open

        throw new \Exception("Tinker: Container {{$name}} not found.");
Severity: Minor
Found in core/Tinker/src/Di/IoCRegistry.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 getController has a boolean flag argument $studlyCaps, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getController($studlyCaps = false);

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

Severity
Category
Status
Source
Language