YetiForceCompany/YetiForceCRM

View on GitHub
app/YetiForce/Updater.php

Summary

Maintainability
A
2 hrs
Test Coverage
F
57%

Function getToInstall has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getToInstall(): array
    {
        $data = self::get();
        if (\Config\Developer::$updaterDevMode) {
            $where = ['like', 'from_version',  self::$version . '.%', false];
Severity: Minor
Found in app/YetiForce/Updater.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 get has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function get(): array
    {
        $fullVer = \explode('.', \App\Version::get());
        array_pop($fullVer);
        self::$version = \implode('.', $fullVer);
Severity: Minor
Found in app/YetiForce/Updater.php - About 1 hr to fix

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

        public static function get(): array
        {
            $fullVer = \explode('.', \App\Version::get());
            array_pop($fullVer);
            self::$version = \implode('.', $fullVer);
    Severity: Minor
    Found in app/YetiForce/Updater.php - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Missing class import via use statement (line '49', column '15').
    Open

                    throw new \App\Exceptions\AppException('Error with connection |' . $response->getStatusCode());
    Severity: Minor
    Found in app/YetiForce/Updater.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 '126', column '9').
    Open

                (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->request('GET', $url, ['sink' => $path]);
    Severity: Minor
    Found in app/YetiForce/Updater.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 '46', column '21').
    Open

                $response = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->request('GET', $url);
    Severity: Minor
    Found in app/YetiForce/Updater.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 '81', column '17').
    Open

            $query = (new \App\Db\Query())->from('yetiforce_updates')->where($where)->andWhere(['result' => 1]);
    Severity: Minor
    Found in app/YetiForce/Updater.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

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

                return \App\Json::read($file);
    Severity: Minor
    Found in app/YetiForce/Updater.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 'get'.
    Open

                \App\Log::endProfile("GET|Updater::get|{$url}", __NAMESPACE__);
    Severity: Minor
    Found in app/YetiForce/Updater.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 '\Settings_ModuleManager_Module_Model' in method 'isDownloaded'.
    Open

            return \file_exists(ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . \Settings_ModuleManager_Module_Model::getUploadDirectory() . \DIRECTORY_SEPARATOR . $package['hash'] . '.zip');
    Severity: Minor
    Found in app/YetiForce/Updater.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 'get'.
    Open

                $body = \App\Json::isEmpty($body) ? [] : \App\Json::decode($body);
    Severity: Minor
    Found in app/YetiForce/Updater.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 'get'.
    Open

                    \App\Json::save($file, $return);
    Severity: Minor
    Found in app/YetiForce/Updater.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 'get'.
    Open

                \App\Log::beginProfile("GET|Updater::get|{$url}", __NAMESPACE__);
    Severity: Minor
    Found in app/YetiForce/Updater.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 'get'.
    Open

                \App\Log::warning('Error - ' . __CLASS__ . ' - ' . $ex->getMessage());
    Severity: Minor
    Found in app/YetiForce/Updater.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\Version' in method 'getToInstall'.
    Open

                $where = ['from_version' => \App\Version::get()];
    Severity: Minor
    Found in app/YetiForce/Updater.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\Version' in method 'getToInstall'.
    Open

                    if ($row['fromVersion'] !== \App\Version::get()) {
    Severity: Minor
    Found in app/YetiForce/Updater.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 'download'.
    Open

                \App\Log::beginProfile("GET|Updater::download|{$url}", __NAMESPACE__);
    Severity: Minor
    Found in app/YetiForce/Updater.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 'download'.
    Open

                \App\Log::warning('Error - ' . __CLASS__ . ' - ' . $ex->getMessage());
    Severity: Minor
    Found in app/YetiForce/Updater.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\Version' in method 'get'.
    Open

            $fullVer = \explode('.', \App\Version::get());
    Severity: Minor
    Found in app/YetiForce/Updater.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 getToInstall uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $where = ['from_version' => \App\Version::get()];
                foreach ($data as $key => $row) {
                    if ($row['fromVersion'] !== \App\Version::get()) {
                        unset($data[$key]);
    Severity: Minor
    Found in app/YetiForce/Updater.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 '\Settings_ModuleManager_Module_Model' in method 'download'.
    Open

                $uploadDir = \Settings_ModuleManager_Module_Model::getUploadDirectory();
    Severity: Minor
    Found in app/YetiForce/Updater.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 'get'.
    Open

                $body = \App\Json::isEmpty($body) ? [] : \App\Json::decode($body);
    Severity: Minor
    Found in app/YetiForce/Updater.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 'download'.
    Open

                \App\Log::endProfile("GET|Updater::download|{$url}", __NAMESPACE__);
    Severity: Minor
    Found in app/YetiForce/Updater.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\RequestHttp' in method 'download'.
    Open

                (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->request('GET', $url, ['sink' => $path]);
    Severity: Minor
    Found in app/YetiForce/Updater.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\RequestHttp' in method 'get'.
    Open

                $response = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->request('GET', $url);
    Severity: Minor
    Found in app/YetiForce/Updater.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

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

                \App\Log::beginProfile("GET|Updater::get|{$url}", __NAMESPACE__);
    Severity: Critical
    Found in app/YetiForce/Updater.php by phan

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

                (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->request('GET', $url, ['sink' => $path]);
    Severity: Critical
    Found in app/YetiForce/Updater.php by phan

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

                \App\Log::warning('Error - ' . __CLASS__ . ' - ' . $ex->getMessage());
    Severity: Critical
    Found in app/YetiForce/Updater.php by phan

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

                \App\Log::warning('Error - ' . __CLASS__ . ' - ' . $ex->getMessage());
    Severity: Critical
    Found in app/YetiForce/Updater.php by phan

    Reference to static property updaterDevMode from undeclared class \Config\Developer
    Open

                if (\Config\Developer::$updaterDevMode) {
    Severity: Critical
    Found in app/YetiForce/Updater.php by phan

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

                $response = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->request('GET', $url);
    Severity: Critical
    Found in app/YetiForce/Updater.php by phan

    Call to undeclared method \App\Db\Query::from
    Open

            $query = (new \App\Db\Query())->from('yetiforce_updates')->where($where)->andWhere(['result' => 1]);
    Severity: Critical
    Found in app/YetiForce/Updater.php by phan

    Reference to static property updaterDevMode from undeclared class \Config\Developer
    Open

            if (\Config\Developer::$updaterDevMode) {
    Severity: Critical
    Found in app/YetiForce/Updater.php by phan

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

                \App\Log::beginProfile("GET|Updater::download|{$url}", __NAMESPACE__);
    Severity: Critical
    Found in app/YetiForce/Updater.php by phan

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

                $response = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->request('GET', $url);
    Severity: Critical
    Found in app/YetiForce/Updater.php by phan

    Reference to static property updaterDevMode from undeclared class \Config\Developer
    Open

            $updaterMode = \Config\Developer::$updaterDevMode ? 'developer' : 'master';
    Severity: Critical
    Found in app/YetiForce/Updater.php by phan

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

                \App\Log::endProfile("GET|Updater::download|{$url}", __NAMESPACE__);
    Severity: Critical
    Found in app/YetiForce/Updater.php by phan

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

                (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->request('GET', $url, ['sink' => $path]);
    Severity: Critical
    Found in app/YetiForce/Updater.php by phan

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

                \App\Log::endProfile("GET|Updater::get|{$url}", __NAMESPACE__);
    Severity: Critical
    Found in app/YetiForce/Updater.php by phan

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

            $fullVer = \explode('.', \App\Version::get());
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            self::$version = \implode('.', $fullVer);
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                $where = ['from_version' => \App\Version::get()];
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                \App\Log::beginProfile("GET|Updater::get|{$url}", __NAMESPACE__);
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            if (\file_exists($file) && filemtime($file) > strtotime('-5 minute')) {
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            $data = self::get();
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                \App\Log::warning('Error - ' . __CLASS__ . ' - ' . $ex->getMessage());
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                foreach ($data as $key => $row) {
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            array_pop($fullVer);
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            try {
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

    Line exceeds 120 characters; contains 140 characters
    Open

                $url = "https://github.com/YetiForceCompany/UpdatePackages/raw/{$updaterMode}/YetiForce%20CRM%20{$fullVer[0]}.x.x/Updater.json";
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

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

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

                $body = \App\Json::isEmpty($body) ? [] : \App\Json::decode($body);
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                }
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         * Get updates to install.
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                $response = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->request('GET', $url);
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                    $return = $body[self::$version];
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                $where = ['like', 'from_version',  self::$version . '.%', false];
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         * @var string
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            $file = ROOT_DIRECTORY . '/app_data/SystemUpdater.json';
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                $url = "https://github.com/YetiForceCompany/UpdatePackages/raw/{$updaterMode}/YetiForce%20CRM%20{$fullVer[0]}.x.x/Updater.json";
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                    throw new \App\Exceptions\AppException('Error with connection |' . $response->getStatusCode());
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                $body = $response->getBody();
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            if (\Config\Developer::$updaterDevMode) {
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            } else {
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

        private static $version = '';
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         * @return array
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         * System version for updates.
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            $updaterMode = \Config\Developer::$updaterDevMode ? 'developer' : 'master';
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            $return = [];
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                    \App\Json::save($file, $return);
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         * @return array
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                }
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

        public static function getToInstall(): array
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            return $return;
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

        public static function get(): array
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            } catch (\Throwable $ex) {
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                        unset($data[$key]);
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                \App\Log::warning('Error - ' . __CLASS__ . ' - ' . $ex->getMessage());
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                $updates[$row['name']] = $row;
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         * @param string[] $package
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                $path = ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . $uploadDir . \DIRECTORY_SEPARATOR . $package['hash'] . '.zip';
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                \App\Log::beginProfile("GET|Updater::download|{$url}", __NAMESPACE__);
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                return \App\Json::read($file);
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                \App\Log::endProfile("GET|Updater::get|{$url}", __NAMESPACE__);
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                if ($body && isset($body[self::$version])) {
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         * Get list of available updates.
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            try {
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                $url = $package['url'];
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            foreach ($dataReader as $row) {
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            $updates = [];
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                    unset($data[$key]);
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                }
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         * @return void
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                \App\Log::endProfile("GET|Updater::download|{$url}", __NAMESPACE__);
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                    }
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                if (isset($updates[$row['label']])) {
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

        public static function isDownloaded(array $package): bool
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                $uploadDir = \Settings_ModuleManager_Module_Model::getUploadDirectory();
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                }
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                    if ($row['fromVersion'] !== \App\Version::get()) {
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                    $url = \str_replace('raw/master', 'raw/developer', $url);
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            return $data;
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            return \file_exists(ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . \Settings_ModuleManager_Module_Model::getUploadDirectory() . \DIRECTORY_SEPARATOR . $package['hash'] . '.zip');
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->request('GET', $url, ['sink' => $path]);
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            } catch (\Throwable $ex) {
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            $query = (new \App\Db\Query())->from('yetiforce_updates')->where($where)->andWhere(['result' => 1]);
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                $row['hash'] = \md5($row['label']);
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         * Check if the package has been downloaded.
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         * @return bool
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

    Line exceeds 120 characters; contains 179 characters
    Open

            return \file_exists(ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . \Settings_ModuleManager_Module_Model::getUploadDirectory() . \DIRECTORY_SEPARATOR . $package['hash'] . '.zip');
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         * Download package.
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                if (\Config\Developer::$updaterDevMode) {
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            $dataReader = $query->createCommand()->query();
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

                }
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

            foreach ($data as $key => &$row) {
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

         * @param string[] $package
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

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

        public static function download(array $package)
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

    Line exceeds 120 characters; contains 122 characters
    Open

                $path = ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . $uploadDir . \DIRECTORY_SEPARATOR . $package['hash'] . '.zip';
    Severity: Minor
    Found in app/YetiForce/Updater.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status