YetiForceCompany/YetiForceCRM

View on GitHub
app/Security/Dependency.php

Summary

Maintainability
A
1 hr
Test Coverage
F
27%

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

    public function check(): array
    {
        $result = [];
        if (!\App\YetiForce\Shop::check('YetiForceVulnerabilities')) {
            return $result;
Severity: Minor
Found in app/Security/Dependency.php - About 1 hr to fix

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

        public function check(): array
        {
            $result = [];
            if (!\App\YetiForce\Shop::check('YetiForceVulnerabilities')) {
                return $result;
    Severity: Minor
    Found in app/Security/Dependency.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

    Missing class import via use statement (line '101', column '22').
    Open

                    $response = (new \GuzzleHttp\Client($options))->post($this->checkUrl, ['json' => [
    Severity: Minor
    Found in app/Security/Dependency.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 securityChecker has a boolean flag argument $cache, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function securityChecker(bool $cache = true): array
    Severity: Minor
    Found in app/Security/Dependency.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

    Avoid using static access to class '\App\RequestHttp' in method 'check'.
    Open

                $options = \App\RequestHttp::getOptions();
    Severity: Minor
    Found in app/Security/Dependency.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

    Avoid using static access to class '\App\Utils\ConfReport' in method 'check'.
    Open

                        'env' => \App\Utils\ConfReport::getEnv(),
    Severity: Minor
    Found in app/Security/Dependency.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

    Avoid using static access to class '\App\Log' in method 'check'.
    Open

                    \App\Log::warning($e->__toString(), __CLASS__);
    Severity: Minor
    Found in app/Security/Dependency.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

    Avoid using static access to class '\App\Json' in method 'check'.
    Open

                        $result = (array) \App\Json::decode($response->getBody()->getContents());
    Severity: Minor
    Found in app/Security/Dependency.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

    Avoid using static access to class '\App\Config' in method 'hasCache'.
    Open

                && \time() - \filemtime(static::CACHE_FILE_NAME) < (int) \App\Config::security('CACHE_LIFETIME_SENSIOLABS_SECURITY_CHECKER');
    Severity: Minor
    Found in app/Security/Dependency.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

    Avoid assigning values to variables in if clauses and the like (line '94', column '53').
    Open

        public function check(): array
        {
            $result = [];
            if (!\App\YetiForce\Shop::check('YetiForceVulnerabilities')) {
                return $result;
    Severity: Minor
    Found in app/Security/Dependency.php by phpmd

    IfStatementAssignment

    Since: 2.7.0

    Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($foo = 'bar') { // possible typo
                // ...
            }
            if ($baz = 0) { // always false
                // ...
            }
        }
    }

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

    Avoid using static access to class '\App\Log' in method 'check'.
    Open

                \App\Log::endProfile("POST|Dependency::check|{$this->checkUrl}", __NAMESPACE__);
    Severity: Minor
    Found in app/Security/Dependency.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 securityChecker uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $result = $this->check();
                $this->saveCache($result);
            }
    Severity: Minor
    Found in app/Security/Dependency.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 '\App\YetiForce\Shop' in method 'check'.
    Open

            if (!\App\YetiForce\Shop::check('YetiForceVulnerabilities')) {
    Severity: Minor
    Found in app/Security/Dependency.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

    Avoid using static access to class '\App\RequestUtil' in method 'check'.
    Open

            if (\App\RequestUtil::isNetConnection() && !empty($lockFile = $this->getLockFile(ROOT_DIRECTORY))) {
    Severity: Minor
    Found in app/Security/Dependency.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

    Avoid using static access to class '\App\Json' in method 'saveCache'.
    Open

            \file_put_contents(static::CACHE_FILE_NAME, \App\Json::encode($result));
    Severity: Minor
    Found in app/Security/Dependency.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

    Avoid using static access to class '\App\Json' in method 'getCache'.
    Open

            return \App\Json::decode(\file_get_contents(static::CACHE_FILE_NAME));
    Severity: Minor
    Found in app/Security/Dependency.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

    Avoid using static access to class '\App\YetiForce\Register' in method 'check'.
    Open

                $options['headers']['APP-ID'] = \App\YetiForce\Register::getInstanceKey();
    Severity: Minor
    Found in app/Security/Dependency.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

    Avoid using static access to class '\App\Log' in method 'check'.
    Open

                \App\Log::beginProfile("POST|Dependency::check|{$this->checkUrl}", __NAMESPACE__);
    Severity: Minor
    Found in app/Security/Dependency.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

    Define a constant instead of duplicating this literal "packages" 4 times.
    Open

            $packages = ['packages' => []];
    Severity: Critical
    Found in app/Security/Dependency.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "composer.lock" 3 times.
    Open

            if (is_dir($lock) && file_exists($lock . \DIRECTORY_SEPARATOR . 'composer.lock')) {
    Severity: Critical
    Found in app/Security/Dependency.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "version" 3 times.
    Open

                        'curl' => curl_version()['version'],
    Severity: Critical
    Found in app/Security/Dependency.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Call to method __construct from undeclared class \GuzzleHttp\Client
    Open

                    $response = (new \GuzzleHttp\Client($options))->post($this->checkUrl, ['json' => [
    Severity: Critical
    Found in app/Security/Dependency.php by phan

    Call to method endProfile from undeclared class \App\Log
    Open

                \App\Log::endProfile("POST|Dependency::check|{$this->checkUrl}", __NAMESPACE__);
    Severity: Critical
    Found in app/Security/Dependency.php by phan

    Call to method warning from undeclared class \App\Log
    Open

                    \App\Log::warning($e->__toString(), __CLASS__);
    Severity: Critical
    Found in app/Security/Dependency.php by phan

    Call to method check from undeclared class \App\YetiForce\Shop
    Open

            if (!\App\YetiForce\Shop::check('YetiForceVulnerabilities')) {
    Severity: Critical
    Found in app/Security/Dependency.php by phan

    Call to method post from undeclared class \GuzzleHttp\Client
    Open

                    $response = (new \GuzzleHttp\Client($options))->post($this->checkUrl, ['json' => [
    Severity: Critical
    Found in app/Security/Dependency.php by phan

    Call to method getInstanceKey from undeclared class \App\YetiForce\Register
    Open

                $options['headers']['APP-ID'] = \App\YetiForce\Register::getInstanceKey();
    Severity: Critical
    Found in app/Security/Dependency.php by phan

    Call to method beginProfile from undeclared class \App\Log
    Open

                \App\Log::beginProfile("POST|Dependency::check|{$this->checkUrl}", __NAMESPACE__);
    Severity: Critical
    Found in app/Security/Dependency.php by phan

    Call to method getEnv from undeclared class \App\Utils\ConfReport (Did you mean class \Tests\Settings\ConfReport)
    Open

                        'env' => \App\Utils\ConfReport::getEnv(),
    Severity: Critical
    Found in app/Security/Dependency.php by phan

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param bool $cache
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            } else {
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return array
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->saveCache($result);
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        private function hasCache(): bool
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Security checker.
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $result = $this->getCache();
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                && \time() - \filemtime(static::CACHE_FILE_NAME) < (int) \App\Config::security('CACHE_LIFETIME_SENSIOLABS_SECURITY_CHECKER');
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        const CACHE_FILE_NAME = ROOT_DIRECTORY . '/cache/security/dependency.json';
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @throws \App\Exceptions\AppException
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $result = [];
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Check if a cache is available.
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @var string Cache file name.
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @var string Symfony check url.
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return bool
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ($cache && $this->hasCache()) {
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                && \filesize(static::CACHE_FILE_NAME) > 0
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param array $result
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        private function saveCache(array $result): void
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Get data from the cache.
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            \file_put_contents(static::CACHE_FILE_NAME, \App\Json::encode($result));
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $result = $this->check();
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        private $checkUrl = 'https://security.yetiforce.com/vulnerabilities';
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function securityChecker(bool $cache = true): array
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return array
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        private function getCache(): array
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Save the data to the cache.
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $lock = str_replace('composer.json', 'composer.lock', $lock);
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (is_file($lock)) {
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        $result = (array) \App\Json::decode($response->getBody()->getContents());
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $result = [];
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (!\App\YetiForce\Shop::check('YetiForceVulnerabilities')) {
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $options['allow_redirects'] = false;
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        'env' => \App\Utils\ConfReport::getEnv(),
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        'name' => $package['name'],
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        'version' => $package['version'],
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $result;
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Line exceeds 120 characters; contains 137 characters
    Open

                && \time() - \filemtime(static::CACHE_FILE_NAME) < (int) \App\Config::security('CACHE_LIFETIME_SENSIOLABS_SECURITY_CHECKER');
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                try {
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                \App\Log::endProfile("POST|Dependency::check|{$this->checkUrl}", __NAMESPACE__);
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Get parsed lock file elements.
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        'time' => $package['time'],
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $options = \App\RequestHttp::getOptions();
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    }
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $contents = json_decode(file_get_contents($lock), true);
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $packages['packages'][] = [
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ]]);
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return \App\Json::decode(\file_get_contents(static::CACHE_FILE_NAME));
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Send lock file to verify.
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        'php' => PHP_VERSION,
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $result;
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param string $lock
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ];
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return \file_exists(static::CACHE_FILE_NAME)
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                } catch (\Throwable $e) {
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Get lock file content.
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (is_dir($lock) && file_exists($lock . \DIRECTORY_SEPARATOR . 'composer.lock')) {
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (\App\RequestUtil::isNetConnection() && !empty($lockFile = $this->getLockFile(ROOT_DIRECTORY))) {
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $options['headers']['APP-ID'] = \App\YetiForce\Register::getInstanceKey();
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $response = (new \GuzzleHttp\Client($options))->post($this->checkUrl, ['json' => [
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    if (200 === $response->getStatusCode()) {
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param string $lock
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            } elseif (preg_match('/composer\.json$/', $lock)) {
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return array
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        private function getLockContent(string $lock): array
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return array
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                \App\Log::beginProfile("POST|Dependency::check|{$this->checkUrl}", __NAMESPACE__);
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $packages;
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $options['http_errors'] = false;
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        'curl' => curl_version()['version'],
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return [];
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $packages = ['packages' => []];
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                return $result;
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    \App\Log::warning($e->__toString(), __CLASS__);
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                foreach ($contents['packages'] as $package) {
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function check(): array
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        'dependencies' => $lockFile,
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        private function getLockFile(string $lock): array
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                return $this->getLockContent($lock);
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        $result = (\is_array($result) && !empty($result)) ? $result : [];
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return array
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $lock = $lock . \DIRECTORY_SEPARATOR . 'composer.lock';
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (\is_array($contents['packages'])) {
    Severity: Minor
    Found in app/Security/Dependency.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status