YetiForceCompany/YetiForceCRM

View on GitHub
app/YetiForce/ApiClient.php

Summary

Maintainability
A
1 hr
Test Coverage

Method send has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function send(string $url, string $method, array $option = []): bool
    {
        $this->error = null;
        $this->success = false;
        $this->basicValidations($url);
Severity: Minor
Found in app/YetiForce/ApiClient.php - About 1 hr to fix

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

        public function send(string $url, string $method, array $option = []): bool
        {
            $this->error = null;
            $this->success = false;
            $this->basicValidations($url);
    Severity: Minor
    Found in app/YetiForce/ApiClient.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 '58', column '21').
    Open

                $response = (new \GuzzleHttp\Client($this->getRequestOptions()))->request($method, $url, $option);
    Severity: Minor
    Found in app/YetiForce/ApiClient.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 assigning values to variables in if clauses and the like (line '67', column '44').
    Open

        public function send(string $url, string $method, array $option = []): bool
        {
            $this->error = null;
            $this->success = false;
            $this->basicValidations($url);
    Severity: Minor
    Found in app/YetiForce/ApiClient.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\Json' in method 'send'.
    Open

                if (\App\Json::isJson($this->error) && ($error = \App\Json::decode($this->error)['errors'] ?? null)) {
    Severity: Minor
    Found in app/YetiForce/ApiClient.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\Language' in method 'getRequestOptions'.
    Open

                'accept-language' => \App\Language::getLanguage() ?: 'en'
    Severity: Minor
    Found in app/YetiForce/ApiClient.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 'basicValidations'.
    Open

                \App\Log::warning('ERR_REGISTER_FILES_PERMISSIONS||app_data', __METHOD__);
    Severity: Minor
    Found in app/YetiForce/ApiClient.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 'send'.
    Open

    }
    Severity: Minor
    Found in app/YetiForce/ApiClient.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 'getRequestOptions'.
    Open

                'x-app-id' => Register::getInstanceKey(),
    Severity: Minor
    Found in app/YetiForce/ApiClient.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 'getRequestOptions'.
    Open

            $options = \App\RequestHttp::getOptions();
    Severity: Minor
    Found in app/YetiForce/ApiClient.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 'basicValidations'.
    Open

                \App\Log::warning('ERR_NO_INTERNET_CONNECTION', __METHOD__);
    Severity: Minor
    Found in app/YetiForce/ApiClient.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 'send'.
    Open

                \App\Log::error($e->getMessage(), __METHOD__);
    Severity: Minor
    Found in app/YetiForce/ApiClient.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 'basicValidations'.
    Open

            if (!\App\RequestUtil::isNetConnection() || $hostName === gethostbyname($hostName)) {
    Severity: Minor
    Found in app/YetiForce/ApiClient.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 'send'.
    Open

                \App\Log::error($e->getMessage(), __METHOD__);
    Severity: Minor
    Found in app/YetiForce/ApiClient.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 'send'.
    Open

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

        public function getRequestOptions(): array
        {
            $headers = [
                'x-crm-id' => \App\Config::main('application_unique_key'),
                'x-app-id' => Register::getInstanceKey(),
    Severity: Minor
    Found in app/YetiForce/ApiClient.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\Config' in method 'getRequestOptions'.
    Open

                'x-crm-id' => \App\Config::main('application_unique_key'),
    Severity: Minor
    Found in app/YetiForce/ApiClient.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 'send'.
    Open

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

                $this->error = \App\Language::translate("LBL_ERROR");
    Severity: Minor
    Found in app/YetiForce/ApiClient.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 'send'.
    Open

                \App\Log::error($e->getMessage(), __METHOD__);
    Severity: Minor
    Found in app/YetiForce/ApiClient.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

    syntax error, unexpected '?', expecting function (T_FUNCTION) or const (T_CONST)
    Open

        public ?string $error = null;
    Severity: Critical
    Found in app/YetiForce/ApiClient.php by phan

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

                return $this->success;
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

                $this->responseCode = $e->getResponse()->getStatusCode();
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

                \App\Log::error($e->getMessage(), __METHOD__);
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

                \App\Log::error($e->getMessage(), __METHOD__);
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

        private int $timeout = 20;
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

                $this->responseCode = $e->getResponse()->getStatusCode();
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

                $this->error = \App\Language::translate("LBL_ERROR");
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

            return $this->success;
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

        public ?string $error = null;
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

        private int $connectTimeout = 10;
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

        public function send(string $url, string $method, array $option = []): bool
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

                'timeout' => $this->timeout,
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

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

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

         * Check write permissions for the registry file.
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

        /** @var int Total timeout of the request in seconds. */
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

         * @return mixed
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

                'x-app-id' => Register::getInstanceKey(),
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

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

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

            return array_merge($options, [
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

                'connect_timeout' => $this->connectTimeout
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

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

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

        /** @var int|null Resopnse code */
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

                \App\Log::beginProfile($method . '|' . __METHOD__ . "|{$url}", __NAMESPACE__);
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

                $this->responseBody = $response->getBody()->getContents();
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

            $this->error = null;
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

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

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

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

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

                'x-crm-id' => \App\Config::main('application_unique_key'),
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

                $headers['x-api-key'] = $key;
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

         * Basic validations.
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

            if (!\App\RequestUtil::isNetConnection() || $hostName === gethostbyname($hostName)) {
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

        private $responseBody;
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

                \App\Log::endProfile($method . '|' . __METHOD__ . "|{$url}", __NAMESPACE__);
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

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

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

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

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

         * Get last error.
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

            return $this->error ?? '';
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

                \App\Log::warning('ERR_REGISTER_FILES_PERMISSIONS||app_data', __METHOD__);
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

            $path = Register::REGISTRATION_FILE;
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

            return (file_exists($path) && is_writable($path)) || (!file_exists($path) && is_writable(\dirname($path)));
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

        /** @var bool Response result */
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

            if ($this->error) {
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

            } catch (\GuzzleHttp\Exception\ClientException $e) {
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

                $this->error = $this->responseCode . ' Internal Server Error';
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

            $hostName = parse_url($url, PHP_URL_HOST);
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

        private function isWritable(): bool
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

        public const URL = 'https://api.yetiforce.eu/registrations';
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

            $this->basicValidations($url);
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

                $this->responseCode = $response->getStatusCode();
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

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

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

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

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

        private bool $success;
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

        private ?int $responseCode = 0;
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

         * @param string $url
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

         * @param array  $option
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

                if (\App\Json::isJson($this->error) && ($error = \App\Json::decode($this->error)['errors'] ?? null)) {
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

         * Get response status code.
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

         * @return int
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

         * Get response content.
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

                'headers' => array_merge($options['headers'] ?? [], $headers),
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

         * Send registration data.
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

            $this->success = false;
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

                $response = (new \GuzzleHttp\Client($this->getRequestOptions()))->request($method, $url, $option);
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

                $this->error = $e->getResponse()->getBody()->getContents();
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

                    $this->error = \is_array($error) ? implode(' | ', $error) : $error;
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

        public function getStatusCode()
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

         * @return string
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

         * Get request options.
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

            ]);
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

        private function basicValidations($url)
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

                \App\Log::warning('ERR_NO_INTERNET_CONNECTION', __METHOD__);
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

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

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

            return $this->responseCode;
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

        public function getRequestOptions(): array
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

            if ($key = (new Config())->getToken()) {
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

         * @param string $url
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

            return $this->responseBody;
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

                'accept-language' => \App\Language::getLanguage() ?: 'en'
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

            ];
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

                $this->error = 'ERR_REGISTER_FILES_PERMISSIONS||app_data';
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

        /** @var int The number of seconds to wait while trying to connect to a server. */
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

                $this->success = true;
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

                \App\Log::error($e->getMessage(), __METHOD__);
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

            $headers = [
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

         * @param string $method
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

            } catch (\GuzzleHttp\Exception\ServerException $e) {
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

        public function getError(): string
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

                $this->error = 'ERR_NO_INTERNET_CONNECTION';
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

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

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

        public function getResponseBody()
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

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

            } elseif (!$this->isWritable()) {
    Severity: Minor
    Found in app/YetiForce/ApiClient.php by phpcodesniffer

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

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

    There are no issues that match your filters.

    Category
    Status