TikiWiki/tiki-manager

View on GitHub
src/Libs/Helpers/functions.php

Summary

Maintainability
D
1 day
Test Coverage

secure_trim_data accesses the super-global variable $_ENV.
Open

function secure_trim_data($should_set = false)
{
    $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
    $stat = stat($_ENV['TRIM_DATA']);

Severity: Minor
Found in src/Libs/Helpers/functions.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

secure_trim_data accesses the super-global variable $_ENV.
Open

function secure_trim_data($should_set = false)
{
    $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
    $stat = stat($_ENV['TRIM_DATA']);

Severity: Minor
Found in src/Libs/Helpers/functions.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

promptUser accesses the super-global variable $_ENV.
Open

function promptUser($prompt, $default = false, $values = [])
{
    if (!$_ENV['INTERACTIVE']) {
        return $default;
    }
Severity: Minor
Found in src/Libs/Helpers/functions.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

trim_debug accesses the super-global variable $_ENV.
Open

function trim_debug($output)
{
    if ($_ENV['TRIM_DEBUG']) {
        trim_output($output);
    }
Severity: Minor
Found in src/Libs/Helpers/functions.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

The function query() calls the typical debug function var_dump() which is mostly only used during development.
Open

            var_dump($params);
Severity: Minor
Found in src/Libs/Helpers/functions.php by phpmd

DevelopmentCodeFragment

Since: 2.3.0

Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.

Example

class SuspectCode {

    public function doSomething(array $items)
    {
        foreach ($items as $i => $item) {
            // …

            if ('qafoo' == $item) var_dump($i);

            // …
        }
    }
}

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

The function query() calls the typical debug function debug_print_backtrace() which is mostly only used during development.
Open

            debug_print_backtrace();
Severity: Minor
Found in src/Libs/Helpers/functions.php by phpmd

DevelopmentCodeFragment

Since: 2.3.0

Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.

Example

class SuspectCode {

    public function doSomething(array $items)
    {
        foreach ($items as $i => $item) {
            // …

            if ('qafoo' == $item) var_dump($i);

            // …
        }
    }
}

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

setupPhar accesses the super-global variable $_ENV.
Open

function setupPhar()
{
    $pharPath = Phar::running(false);

    $phar = new Phar($pharPath);
Severity: Minor
Found in src/Libs/Helpers/functions.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

debug accesses the super-global variable $_ENV.
Open

function debug($text, $prefix = null, $hr = '')
{
    if (isset($_ENV['TRIM_DEBUG']) && $_ENV['TRIM_DEBUG'] === true) {
        $prefix = '[' . date('Y-m-d H:i:s') . '][debug]:' . ($prefix ? " {$prefix}" : '');
        $output = "\n";
Severity: Minor
Found in src/Libs/Helpers/functions.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

secure_trim_data accesses the super-global variable $_ENV.
Open

function secure_trim_data($should_set = false)
{
    $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
    $stat = stat($_ENV['TRIM_DATA']);

Severity: Minor
Found in src/Libs/Helpers/functions.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

setupPhar accesses the super-global variable $_ENV.
Open

function setupPhar()
{
    $pharPath = Phar::running(false);

    $phar = new Phar($pharPath);
Severity: Minor
Found in src/Libs/Helpers/functions.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

cache_folder accesses the super-global variable $_ENV.
Open

function cache_folder($app, $version)
{
    $key = sprintf('%s-%s-%s', $app->getName(), $version->type, $version->branch);
    $key = str_replace('/', '_', $key);
    $folder = $_ENV['CACHE_FOLDER'] . "/$key";
Severity: Minor
Found in src/Libs/Helpers/functions.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

setupPhar accesses the super-global variable $_ENV.
Open

function setupPhar()
{
    $pharPath = Phar::running(false);

    $phar = new Phar($pharPath);
Severity: Minor
Found in src/Libs/Helpers/functions.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

debug accesses the super-global variable $_ENV.
Open

function debug($text, $prefix = null, $hr = '')
{
    if (isset($_ENV['TRIM_DEBUG']) && $_ENV['TRIM_DEBUG'] === true) {
        $prefix = '[' . date('Y-m-d H:i:s') . '][debug]:' . ($prefix ? " {$prefix}" : '');
        $output = "\n";
Severity: Minor
Found in src/Libs/Helpers/functions.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

trim_output accesses the super-global variable $_ENV.
Open

function trim_output($output)
{
    $fh = fopen($_ENV['TRIM_OUTPUT'], 'a+');
    if (is_resource($fh)) {
        fprintf($fh, "%s\n", $output);
Severity: Minor
Found in src/Libs/Helpers/functions.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

trim_output accesses the super-global variable $_ENV.
Open

function trim_output($output)
{
    $fh = fopen($_ENV['TRIM_OUTPUT'], 'a+');
    if (is_resource($fh)) {
        fprintf($fh, "%s\n", $output);
Severity: Minor
Found in src/Libs/Helpers/functions.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

setupPhar accesses the super-global variable $_ENV.
Open

function setupPhar()
{
    $pharPath = Phar::running(false);

    $phar = new Phar($pharPath);
Severity: Minor
Found in src/Libs/Helpers/functions.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

The function debug() calls the typical debug function debug_print_backtrace() which is mostly only used during development.
Open

            debug_print_backtrace();
Severity: Minor
Found in src/Libs/Helpers/functions.php by phpmd

DevelopmentCodeFragment

Since: 2.3.0

Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.

Example

class SuspectCode {

    public function doSomething(array $items)
    {
        foreach ($items as $i => $item) {
            // …

            if ('qafoo' == $item) var_dump($i);

            // …
        }
    }
}

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

secure_trim_data accesses the super-global variable $_ENV.
Open

function secure_trim_data($should_set = false)
{
    $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
    $stat = stat($_ENV['TRIM_DATA']);

Severity: Minor
Found in src/Libs/Helpers/functions.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

File functions.php has 397 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

define('DS', DIRECTORY_SEPARATOR);

require_once dirname(__DIR__) . '/Requirements/Requirements.php';
Severity: Minor
Found in src/Libs/Helpers/functions.php - About 5 hrs to fix

    Function php has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    function php()
    {
    
        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
            $paths = `where php`;
    Severity: Minor
    Found in src/Libs/Helpers/functions.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 getPassword has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    function getPassword($stars = false)
    {
        // Get current style
        $oldStyle = shell_exec('stty -g');
    
    
    Severity: Minor
    Found in src/Libs/Helpers/functions.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 php has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function php()
    {
    
        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
            $paths = `where php`;
    Severity: Minor
    Found in src/Libs/Helpers/functions.php - About 1 hr to fix

      Method secure_trim_data has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function secure_trim_data($should_set = false)
      {
          $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
          $stat = stat($_ENV['TRIM_DATA']);
      
      
      Severity: Minor
      Found in src/Libs/Helpers/functions.php - About 1 hr to fix

        Function promptUser has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        function promptUser($prompt, $default = false, $values = [])
        {
            if (!$_ENV['INTERACTIVE']) {
                return $default;
            }
        Severity: Minor
        Found in src/Libs/Helpers/functions.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 debug has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        function debug($text, $prefix = null, $hr = '')
        {
            if (isset($_ENV['TRIM_DEBUG']) && $_ENV['TRIM_DEBUG'] === true) {
                $prefix = '[' . date('Y-m-d H:i:s') . '][debug]:' . ($prefix ? " {$prefix}" : '');
                $output = "\n";
        Severity: Minor
        Found in src/Libs/Helpers/functions.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

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

        function query($query, $params = null)
        {
            if (is_null($params)) {
                $params = [];
            }
        Severity: Minor
        Found in src/Libs/Helpers/functions.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 function promptUser() has an NPath complexity of 234. The configured NPath complexity threshold is 200.
        Open

        function promptUser($prompt, $default = false, $values = [])
        {
            if (!$_ENV['INTERACTIVE']) {
                return $default;
            }
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        NPathComplexity

        Since: 0.1

        The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

        Example

        class Foo {
            function bar() {
                // lots of complicated code
            }
        }

        Source https://phpmd.org/rules/codesize.html#npathcomplexity

        The function promptUser() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
        Open

        function promptUser($prompt, $default = false, $values = [])
        {
            if (!$_ENV['INTERACTIVE']) {
                return $default;
            }
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        CyclomaticComplexity

        Since: 0.1

        Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

        Example

        // Cyclomatic Complexity = 11
        class Foo {
        1   public function example() {
        2       if ($a == $b) {
        3           if ($a1 == $b1) {
                        fiddle();
        4           } elseif ($a2 == $b2) {
                        fiddle();
                    } else {
                        fiddle();
                    }
        5       } elseif ($c == $d) {
        6           while ($c == $d) {
                        fiddle();
                    }
        7        } elseif ($e == $f) {
        8           for ($n = 0; $n < $h; $n++) {
                        fiddle();
                    }
                } else {
                    switch ($z) {
        9               case 1:
                            fiddle();
                            break;
        10              case 2:
                            fiddle();
                            break;
        11              case 3:
                            fiddle();
                            break;
                        default:
                            fiddle();
                            break;
                    }
                }
            }
        }

        Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

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

        function getPassword($stars = false)
        Severity: Minor
        Found in src/Libs/Helpers/functions.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 secure_trim_data has a boolean flag argument $should_set, which is a certain sign of a Single Responsibility Principle violation.
        Open

        function secure_trim_data($should_set = false)
        Severity: Minor
        Found in src/Libs/Helpers/functions.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 '496', column '19').
        Open

                throw new Exception($message);
        Severity: Minor
        Found in src/Libs/Helpers/functions.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

        Remove error control operator '@' on line 416.
        Open

        function php()
        {
        
            if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
                $paths = `where php`;
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        ErrorControlOperator

        Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

        Example

        function foo($filePath) {
            $file = @fopen($filPath); // hides exceptions
            $key = @$array[$notExistingKey]; // assigns null to $key
        }

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

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

                throw new Exception('There was a problem when installing Composer.');
        Severity: Minor
        Found in src/Libs/Helpers/functions.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 '491', column '23').
        Open

                    throw new \Exception('Failed to copy file to ' . $setupFile);
        Severity: Minor
        Found in src/Libs/Helpers/functions.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 '443', column '17').
        Open

            $phar = new Phar($pharPath);
        Severity: Minor
        Found in src/Libs/Helpers/functions.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 promptPassword has a boolean flag argument $allowEmpty, which is a certain sign of a Single Responsibility Principle violation.
        Open

        function promptPassword($prompt = "Password", $stars = true, $allowEmpty = false)
        Severity: Minor
        Found in src/Libs/Helpers/functions.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 promptUser has a boolean flag argument $default, which is a certain sign of a Single Responsibility Principle violation.
        Open

        function promptUser($prompt, $default = false, $values = [])
        Severity: Minor
        Found in src/Libs/Helpers/functions.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

        Remove error control operator '@' on line 412.
        Open

        function php()
        {
        
            if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
                $paths = `where php`;
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        ErrorControlOperator

        Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

        Example

        function foo($filePath) {
            $file = @fopen($filPath); // hides exceptions
            $key = @$array[$notExistingKey]; // assigns null to $key
        }

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

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

                throw new Exception('Invalid composer installer signature.');
        Severity: Minor
        Found in src/Libs/Helpers/functions.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 '552', column '19').
        Open

                throw new Exception('There was a problem when installing Tiki Manager dependencies.');
        Severity: Minor
        Found in src/Libs/Helpers/functions.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 promptPassword has a boolean flag argument $stars, which is a certain sign of a Single Responsibility Principle violation.
        Open

        function promptPassword($prompt = "Password", $stars = true, $allowEmpty = false)
        Severity: Minor
        Found in src/Libs/Helpers/functions.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 php uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

            } else {
                $paths = `whereis php 2>> logs/trim.output`;
            }
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

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

        The method query uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    $query = str_replace($key, "'$value'", $query);
                }
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

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

        The method getPassword uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                    } else {
                        fwrite(STDOUT, "*");
                        $password .= $char;
                    }
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

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

        Avoid using static access to class 'TikiManager\Libs\Requirements\Requirements' in method 'detectComposer'.
        Open

            $requirementsInstance = TikiManager\Libs\Requirements\Requirements::getInstance();
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        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 method getPassword uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

            } else {
                shell_exec('stty -icanon -echo min 1 time 0');
                $password = '';
        
                while (true) {
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

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

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

                list($name, $pass, $uid, $comment, $home, $shell) = explode(':', $line);
        Severity: Minor
        Found in src/Libs/Helpers/functions.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

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

                list($name, $pass, $uid, $comment, $home, $shell) = explode(':', $line);
        Severity: Minor
        Found in src/Libs/Helpers/functions.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

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

                list($name, $pass, $gid, $users) = explode(':', $line);
        Severity: Minor
        Found in src/Libs/Helpers/functions.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

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

            foreach ($instances as $key => $i) {
        Severity: Minor
        Found in src/Libs/Helpers/functions.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

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

            exec($command, $output, $exitCode);
        Severity: Minor
        Found in src/Libs/Helpers/functions.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

        The function query() contains an exit expression.
        Open

                    exit(1);
        Severity: Minor
        Found in src/Libs/Helpers/functions.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

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

                list($name, $pass, $uid, $comment, $home, $shell) = explode(':', $line);
        Severity: Minor
        Found in src/Libs/Helpers/functions.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

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

                list($name, $pass, $uid, $comment, $home, $shell) = explode(':', $line);
        Severity: Minor
        Found in src/Libs/Helpers/functions.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

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

            $result = $phar->extractTo($_ENV['TRIM_ROOT'], explode(',', $_ENV['EXECUTABLE_SCRIPT']), true);
        Severity: Minor
        Found in src/Libs/Helpers/functions.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

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

                list($name, $pass, $gid, $users) = explode(':', $line);
        Severity: Minor
        Found in src/Libs/Helpers/functions.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

        TODO found
        Open

            // TODO: log error
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by fixme

        Call to deprecated function \appendFlush() defined at /code/src/Libs/Helpers/functions.php:117
        Open

            echo color("$text\n", 'cyan') . appendFlush();
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phan

        Invalid operator: left operand of >> is mixed (expected int)
        Open

                        $modes[($cur_mode >> 6) & 0b111],
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phan

        Invalid operator: left operand of >> is mixed (expected int)
        Open

                        $modes[($cur_mode >> 3) & 0b111],
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phan

        Call to deprecated function \color() defined at /code/src/Libs/Helpers/functions.php:27
        Open

                echo color($output, 'pink');
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phan

        Call to deprecated function \color() defined at /code/src/Libs/Helpers/functions.php:27
        Open

            echo color("$text\n", 'yellow') . appendFlush();
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phan

        Call to deprecated function \appendFlush() defined at /code/src/Libs/Helpers/functions.php:117
        Open

            echo color("$text\n", 'red') . appendFlush();
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phan

        Function readline defined at /code/src/Libs/Helpers/functions.php:15 was previously defined internally
        Open

            function readline($prompt)
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phan

        Call to deprecated function \appendFlush() defined at /code/src/Libs/Helpers/functions.php:117
        Open

            echo color("$text\n", 'yellow') . appendFlush();
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phan

        Argument 2 (replace) is int but \str_replace() takes array|string
        Open

                    $query = str_replace($key, (int)$value, $query);
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phan

        Default value for string $default can't be false
        Open

        function promptUser($prompt, $default = false, $values = [])
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phan

        Call to deprecated function \error() defined at /code/src/Libs/Helpers/functions.php:145
        Open

                error("Invalid response.\n");
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phan

        Invalid operator: left operand of >> is mixed (expected int)
        Open

            $exp_mode = (($cur_mode >> 6) << 6) | 0b111000000;
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phan

        Call to deprecated function \color() defined at /code/src/Libs/Helpers/functions.php:27
        Open

            echo color("$text\n", 'cyan') . appendFlush();
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phan

        Call to deprecated function \color() defined at /code/src/Libs/Helpers/functions.php:27
        Open

            echo color("$text\n", 'red') . appendFlush();
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phan

        Function query defined at /code/src/Libs/Helpers/functions.php:246 was previously defined at /code/scripts/tiki/mysqldump.php:50
        Open

        function query($query, $params = null)
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phan

        Call to deprecated function \error() defined at /code/src/Libs/Helpers/functions.php:145
        Open

                    error("Unsupported query parameter type: array\n");
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phan

        Default value for string $values can't be array{}
        Open

        function promptUser($prompt, $default = false, $values = [])
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phan

        The parameter $should_set is not named in camelCase.
        Open

        function secure_trim_data($should_set = false)
        {
            $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
            $stat = stat($_ENV['TRIM_DATA']);
        
        
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        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

        The variable $group_name is not named in camelCase.
        Open

        function secure_trim_data($should_set = false)
        {
            $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
            $stat = stat($_ENV['TRIM_DATA']);
        
        
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        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 $owner_name is not named in camelCase.
        Open

        function secure_trim_data($should_set = false)
        {
            $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
            $stat = stat($_ENV['TRIM_DATA']);
        
        
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        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 $cur_mode is not named in camelCase.
        Open

        function secure_trim_data($should_set = false)
        {
            $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
            $stat = stat($_ENV['TRIM_DATA']);
        
        
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        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 $chmod_success is not named in camelCase.
        Open

        function secure_trim_data($should_set = false)
        {
            $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
            $stat = stat($_ENV['TRIM_DATA']);
        
        
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        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 $cur_mode is not named in camelCase.
        Open

        function secure_trim_data($should_set = false)
        {
            $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
            $stat = stat($_ENV['TRIM_DATA']);
        
        
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        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 $cur_mode is not named in camelCase.
        Open

        function secure_trim_data($should_set = false)
        {
            $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
            $stat = stat($_ENV['TRIM_DATA']);
        
        
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        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 $group_name is not named in camelCase.
        Open

        function secure_trim_data($should_set = false)
        {
            $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
            $stat = stat($_ENV['TRIM_DATA']);
        
        
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        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 $cur_mode is not named in camelCase.
        Open

        function secure_trim_data($should_set = false)
        {
            $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
            $stat = stat($_ENV['TRIM_DATA']);
        
        
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        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 $group_name is not named in camelCase.
        Open

        function secure_trim_data($should_set = false)
        {
            $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
            $stat = stat($_ENV['TRIM_DATA']);
        
        
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        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 $owner_name is not named in camelCase.
        Open

        function secure_trim_data($should_set = false)
        {
            $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
            $stat = stat($_ENV['TRIM_DATA']);
        
        
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        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 $owner_name is not named in camelCase.
        Open

        function secure_trim_data($should_set = false)
        {
            $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
            $stat = stat($_ENV['TRIM_DATA']);
        
        
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        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 $exp_mode is not named in camelCase.
        Open

        function secure_trim_data($should_set = false)
        {
            $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
            $stat = stat($_ENV['TRIM_DATA']);
        
        
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        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 $should_set is not named in camelCase.
        Open

        function secure_trim_data($should_set = false)
        {
            $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
            $stat = stat($_ENV['TRIM_DATA']);
        
        
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        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 $chmod_success is not named in camelCase.
        Open

        function secure_trim_data($should_set = false)
        {
            $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
            $stat = stat($_ENV['TRIM_DATA']);
        
        
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        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 $cur_mode is not named in camelCase.
        Open

        function secure_trim_data($should_set = false)
        {
            $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
            $stat = stat($_ENV['TRIM_DATA']);
        
        
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        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 $cur_mode is not named in camelCase.
        Open

        function secure_trim_data($should_set = false)
        {
            $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
            $stat = stat($_ENV['TRIM_DATA']);
        
        
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        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 $exp_mode is not named in camelCase.
        Open

        function secure_trim_data($should_set = false)
        {
            $modes = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
            $stat = stat($_ENV['TRIM_DATA']);
        
        
        Severity: Minor
        Found in src/Libs/Helpers/functions.php by phpmd

        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