speedworks/speedy

View on GitHub
Core/Classes/BaseController.php

Summary

Maintainability
A
1 hr
Test Coverage

view accesses the super-global variable $_ENV.
Open

    public static function view($view, $arrayParams = [], $exit = false)
    {
        $loader = new Twig_Loader_Filesystem(__DIR__.'/../../Views');
        $cache = __DIR__.'/../../Storage/Cache/Views';
        if(!$_ENV['cache_template'])
Severity: Minor
Found in Core/Classes/BaseController.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

view accesses the super-global variable $_SERVER.
Open

    public static function view($view, $arrayParams = [], $exit = false)
    {
        $loader = new Twig_Loader_Filesystem(__DIR__.'/../../Views');
        $cache = __DIR__.'/../../Storage/Cache/Views';
        if(!$_ENV['cache_template'])
Severity: Minor
Found in Core/Classes/BaseController.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

back accesses the super-global variable $_SERVER.
Open

    public static function back()
    {
        $ref = "location: ".$_SERVER['HTTP_REFERER'];
        header($ref);
    }
Severity: Minor
Found in Core/Classes/BaseController.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

view accesses the super-global variable $_ENV.
Open

    public static function view($view, $arrayParams = [], $exit = false)
    {
        $loader = new Twig_Loader_Filesystem(__DIR__.'/../../Views');
        $cache = __DIR__.'/../../Storage/Cache/Views';
        if(!$_ENV['cache_template'])
Severity: Minor
Found in Core/Classes/BaseController.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

Method view has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function view($view, $arrayParams = [], $exit = false)
    {
        $loader = new Twig_Loader_Filesystem(__DIR__.'/../../Views');
        $cache = __DIR__.'/../../Storage/Cache/Views';
        if(!$_ENV['cache_template'])
Severity: Minor
Found in Core/Classes/BaseController.php - About 1 hr to fix

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

        public static function view($view, $arrayParams = [], $exit = false)
    Severity: Minor
    Found in Core/Classes/BaseController.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 view() contains an exit expression.
    Open

                exit(1);
    Severity: Minor
    Found in Core/Classes/BaseController.php by phpmd

    ExitExpression

    Since: 0.2

    An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

    Example

    class Foo {
        public function bar($param)  {
            if ($param === 42) {
                exit(23);
            }
        }
    }

    Source https://phpmd.org/rules/design.html#exitexpression

    There are no issues that match your filters.

    Category
    Status