Formula9/Framework

View on GitHub
F9/Application/Application.php

Summary

Maintainability
A
1 hr
Test Coverage

Method subRequest has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        string $uri,
        string $method = 'GET',
        array $parameters = [],
        array $cookies = [],
        array $files = [],
Severity: Major
Found in F9/Application/Application.php - About 50 mins to fix

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

        public function boot()
        {
            if ($this->booted) {
                return;
            }
    Severity: Minor
    Found in F9/Application/Application.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 class Application has a coupling between objects value of 15. Consider to reduce the number of dependencies under 13.
    Open

    class Application extends \Silex\Application implements Container
    {
        const VERSION = '0.4.2';
    
        use
    Severity: Minor
    Found in F9/Application/Application.php by phpmd

    CouplingBetweenObjects

    Since: 1.1.0

    A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

    Example

    class Foo {
        /**
         * @var \foo\bar\X
         */
        private $x = null;
    
        /**
         * @var \foo\bar\Y
         */
        private $y = null;
    
        /**
         * @var \foo\bar\Z
         */
        private $z = null;
    
        public function setFoo(\Foo $foo) {}
        public function setBar(\Bar $bar) {}
        public function setBaz(\Baz $baz) {}
    
        /**
         * @return \SplObjectStorage
         * @throws \OutOfRangeException
         * @throws \InvalidArgumentException
         * @throws \ErrorException
         */
        public function process(\Iterator $it) {}
    
        // ...
    }

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

    Avoid unused private methods such as 'registerAliases'.
    Open

        private function registerAliases()
        {
            if ($this->config->has('aliases')) {
                foreach ($this->config['aliases'] as $alias => $class) {
                    class_alias($class, $alias);
    Severity: Minor
    Found in F9/Application/Application.php by phpmd

    UnusedPrivateMethod

    Since: 0.2

    Unused Private Method detects when a private method is declared but is unused.

    Example

    class Something
    {
        private function foo() {} // unused
    }

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

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

            $app = $this;
    Severity: Minor
    Found in F9/Application/Application.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