XoopsModules25x/xoopsinfo

View on GitHub
phpsysinfo/includes/autoloader.inc.php

Summary

Maintainability
A
1 hr
Test Coverage

Consider simplifying this complex logical expression.
Open

    if (PSI_DEBUG || (($level !== 2) && ($level !== 8)) || !(preg_match("/^[^:]*: open_basedir /", $message) || preg_match("/^fopen\(/", $message) || preg_match("/^is_readable\(/", $message) || preg_match("/^file_exists\(/", $message) || preg_match("/^fgets\(/", $message))) { // disable open_basedir, fopen, is_readable, file_exists and fgets warnings and notices
        $error->addPhpError("errorHandlerPsi : ", "Level : ".$level." Message : ".$message." File : ".$file." Line : ".$line);
    }
Severity: Critical
Found in phpsysinfo/includes/autoloader.inc.php - About 1 hr to fix

    Function psi_autoload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    function psi_autoload($class_name)
    {
        //$class_name = str_replace('-', '', $class_name);
    
        /* case-insensitive folders */
    Severity: Minor
    Found in phpsysinfo/includes/autoloader.inc.php - About 25 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 using static access to class 'PSI_Error' in method 'errorHandlerPsi'.
    Open

        $error = PSI_Error::singleton();

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

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

    Avoid using static access to class 'PSI_Error' in method 'psi_autoload'.
    Open

        $error = PSI_Error::singleton();

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

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

    The parameter $class_name is not named in camelCase.
    Open

    function psi_autoload($class_name)
    {
        //$class_name = str_replace('-', '', $class_name);
    
        /* case-insensitive folders */

    CamelCaseParameterName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name parameters.

    Example

    class ClassName {
        public function doSomething($user_name) {
        }
    }

    Source

    A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 25 and the first side effect is on line 16.
    Open

    <?php

    Line exceeds 120 characters; contains 132 characters
    Open

     * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version

    Line exceeds 120 characters; contains 126 characters
    Open

            $error->addPhpError("errorHandlerPsi : ", "Level : ".$level." Message : ".$message." File : ".$file." Line : ".$line);

    Line exceeds 120 characters; contains 127 characters
    Open

        $error->addError("psi_autoload(\"".$class_name."\")", "autoloading of class file (class.".$class_name.".inc.php) failed!");

    Line exceeds 120 characters; contains 229 characters
    Open

        $dirs = array('/includes/', '/includes/interface/', '/includes/to/', '/includes/to/device/', '/includes/os/', '/includes/plugin/', '/includes/xml/', '/includes/web/', '/includes/error/', '/includes/js/', '/includes/output/');

    The variable $class_name is not named in camelCase.
    Open

    function psi_autoload($class_name)
    {
        //$class_name = str_replace('-', '', $class_name);
    
        /* case-insensitive folders */

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $class_name is not named in camelCase.
    Open

    function psi_autoload($class_name)
    {
        //$class_name = str_replace('-', '', $class_name);
    
        /* case-insensitive folders */

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $class_name is not named in camelCase.
    Open

    function psi_autoload($class_name)
    {
        //$class_name = str_replace('-', '', $class_name);
    
        /* case-insensitive folders */

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $class_name is not named in camelCase.
    Open

    function psi_autoload($class_name)
    {
        //$class_name = str_replace('-', '', $class_name);
    
        /* case-insensitive folders */

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $class_name is not named in camelCase.
    Open

    function psi_autoload($class_name)
    {
        //$class_name = str_replace('-', '', $class_name);
    
        /* case-insensitive folders */

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $class_name is not named in camelCase.
    Open

    function psi_autoload($class_name)
    {
        //$class_name = str_replace('-', '', $class_name);
    
        /* case-insensitive folders */

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $class_name is not named in camelCase.
    Open

    function psi_autoload($class_name)
    {
        //$class_name = str_replace('-', '', $class_name);
    
        /* case-insensitive folders */

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    There are no issues that match your filters.

    Category
    Status