YetiForceCompany/YetiForceCRM

View on GitHub
app/Installer/Languages.php

Summary

Maintainability
A
3 hrs
Test Coverage
D
68%

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

    public static function getAll()
    {
        if (!\App\RequestUtil::isNetConnection()) {
            \App\Log::warning('ERR_NO_INTERNET_CONNECTION', __METHOD__);
            return [];
Severity: Minor
Found in app/Installer/Languages.php - About 1 hr to fix

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

        public static function getAll()
        {
            if (!\App\RequestUtil::isNetConnection()) {
                \App\Log::warning('ERR_NO_INTERNET_CONNECTION', __METHOD__);
                return [];
    Severity: Minor
    Found in app/Installer/Languages.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 download has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function download(string $prefix)
        {
            if (!\App\RequestUtil::isNetConnection()) {
                \App\Log::warning('ERR_NO_INTERNET_CONNECTION', __METHOD__);
                static::$lastErrorMessage = 'ERR_NO_INTERNET_CONNECTION';
    Severity: Minor
    Found in app/Installer/Languages.php - About 1 hr to fix

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

          public static function download(string $prefix)
          {
              if (!\App\RequestUtil::isNetConnection()) {
                  \App\Log::warning('ERR_NO_INTERNET_CONNECTION', __METHOD__);
                  static::$lastErrorMessage = 'ERR_NO_INTERNET_CONNECTION';
      Severity: Minor
      Found in app/Installer/Languages.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 '98', column '10').
      Open

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

                          (new \vtlib\Language())->import($path);
      Severity: Minor
      Found in app/Installer/Languages.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 '60', column '21').
      Open

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

              $endpoint = \App\Config::developer('LANGUAGES_UPDATE_DEV_MODE') ? 'Developer' : \App\Version::get();
      Severity: Minor
      Found in app/Installer/Languages.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 'getAll'.
      Open

                  $response = (new \GuzzleHttp\Client())->request('GET', $url, \App\RequestHttp::getOptions());
      Severity: Minor
      Found in app/Installer/Languages.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('ERR_NO_INTERNET_CONNECTION', __METHOD__);
      Severity: Minor
      Found in app/Installer/Languages.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($ex->__toString(), __METHOD__);
      Severity: Minor
      Found in app/Installer/Languages.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 'download'.
      Open

              if (!\App\RequestUtil::isNetConnection()) {
      Severity: Minor
      Found in app/Installer/Languages.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 'download'.
      Open

              $endpoint = \App\Config::developer('LANGUAGES_UPDATE_DEV_MODE') ? 'Developer' : \App\Version::get();
      Severity: Minor
      Found in app/Installer/Languages.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 'download'.
      Open

              $endpoint = \App\Config::developer('LANGUAGES_UPDATE_DEV_MODE') ? 'Developer' : \App\Version::get();
      Severity: Minor
      Found in app/Installer/Languages.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\Fields\File' in method 'download'.
      Open

              if (\App\Fields\File::isExistsUrl($url)) {
      Severity: Minor
      Found in app/Installer/Languages.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|Languages::download|{$url}", __NAMESPACE__);
      Severity: Minor
      Found in app/Installer/Languages.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\Fields\File' in method 'download'.
      Open

              $path = \App\Fields\File::getTmpPath() . $prefix . '.zip';
      Severity: Minor
      Found in app/Installer/Languages.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 'getAll'.
      Open

              $endpoint = \App\Config::developer('LANGUAGES_UPDATE_DEV_MODE') ? 'Developer' : \App\Version::get();
      Severity: Minor
      Found in app/Installer/Languages.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|Languages::download|{$url}", __NAMESPACE__);
      Severity: Minor
      Found in app/Installer/Languages.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 'getAll'.
      Open

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

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

                  \App\Log::beginProfile("GET|Languages::getAll|{$url}", __NAMESPACE__);
      Severity: Minor
      Found in app/Installer/Languages.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 download uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

              } else {
                  static::$lastErrorMessage = 'ERR_CANNOT_PARSE_SERVER_RESPONSE';
              }
      Severity: Minor
      Found in app/Installer/Languages.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\Json' in method 'getAll'.
      Open

                      $body = \App\Json::decode($response->getBody());
      Severity: Minor
      Found in app/Installer/Languages.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 'getAll'.
      Open

                  \App\Log::warning($ex->__toString(), __CLASS__);
      Severity: Minor
      Found in app/Installer/Languages.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/Installer/Languages.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 'getToInstall'.
      Open

              foreach (\App\Language::getAll(true, true) as $key => $row) {
      Severity: Minor
      Found in app/Installer/Languages.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 'getAll'.
      Open

              if (!\App\RequestUtil::isNetConnection()) {
      Severity: Minor
      Found in app/Installer/Languages.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 'getAll'.
      Open

                  \App\Log::endProfile("GET|Languages::getAll|{$url}", __NAMESPACE__);
      Severity: Minor
      Found in app/Installer/Languages.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 "ERR_NO_INTERNET_CONNECTION" 3 times.
      Open

                  \App\Log::warning('ERR_NO_INTERNET_CONNECTION', __METHOD__);
      Severity: Critical
      Found in app/Installer/Languages.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 endProfile from undeclared class \App\Log
      Open

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

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

                  \App\Log::warning('ERR_NO_INTERNET_CONNECTION', __METHOD__);
      Severity: Critical
      Found in app/Installer/Languages.php by phan

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

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

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

                  \App\Log::warning('ERR_NO_INTERNET_CONNECTION', __METHOD__);
      Severity: Critical
      Found in app/Installer/Languages.php by phan

      When fetching an array index from a value of type string, found an array index of type 'time', but expected the index to be of type int
      Open

                  if (isset($langs[$key]) && strtotime($langs[$key]['time']) > strtotime($row['lastupdated'])) {
      Severity: Minor
      Found in app/Installer/Languages.php by phan

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

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

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

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

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

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

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

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

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

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

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

                      \App\Log::warning($ex->__toString(), __METHOD__);
      Severity: Critical
      Found in app/Installer/Languages.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/Installer/Languages.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/Installer/Languages.php by phan

      The 'getToInstall()' method which returns a boolean should be named 'is...()' or 'has...()'
      Open

          public static function getToInstall(): bool
          {
              $langs = self::getAll();
              foreach (\App\Language::getAll(true, true) as $key => $row) {
                  if (isset($langs[$key]) && strtotime($langs[$key]['time']) > strtotime($row['lastupdated'])) {
      Severity: Minor
      Found in app/Installer/Languages.php by phpmd

      BooleanGetMethodName

      Since: 0.2

      Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

      Example

      class Foo {
          /**
           * @return boolean
           */
          public function getFoo() {} // bad
          /**
           * @return bool
           */
          public function isFoo(); // ok
          /**
           * @return boolean
           */
          public function getFoo($bar); // ok, unless checkParameterizedMethods=true
      }

      Source https://phpmd.org/rules/naming.html#booleangetmethodname

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

              }
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

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

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

                          foreach ($body as $prefix => $row) {
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

                  }
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          }
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           * @return bool true if success
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

                  static::$lastErrorMessage = 'ERR_NO_INTERNET_CONNECTION';
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           * Get all languages for the current version.
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              $file = ROOT_DIRECTORY . '/app_data/LanguagesUpdater.json';
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

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

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

                      }
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              return static::$lastErrorMessage;
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          public static function exists(string $prefix): bool
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

                          }
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

                  } catch (\Exception $ex) {
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

                      \App\Log::warning($ex->__toString(), __METHOD__);
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              return $status;
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              $languages = [];
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

                  if (200 === $response->getStatusCode()) {
      Severity: Minor
      Found in app/Installer/Languages.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/Installer/Languages.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              $endpoint = \App\Config::developer('LANGUAGES_UPDATE_DEV_MODE') ? 'Developer' : \App\Version::get();
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          /**
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          }
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          public static function getToInstall(): bool
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

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

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

                      if ($body) {
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

                      static::$lastErrorMessage = $ex->getMessage();
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          }
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          public static function getLastErrorMessage(): ?string
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          {
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           */
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              $langs = self::getAll();
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           * @return string[]
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              if (!\App\RequestUtil::isNetConnection()) {
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              } catch (\Exception $ex) {
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           * Download language.
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

                  return false;
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              $status = false;
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

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

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

                          $status = true;
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              return \file_exists(ROOT_DIRECTORY . '/languages/' . $prefix . '/_Base.json');
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

                      return true;
      Severity: Minor
      Found in app/Installer/Languages.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/Installer/Languages.php by phpcodesniffer

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

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

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

                  static::$lastErrorMessage = 'ERR_CANNOT_PARSE_SERVER_RESPONSE';
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          /**
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           * Check if language exists.
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

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

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

           * @return bool
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              if (!\App\RequestUtil::isNetConnection()) {
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              $path = \App\Fields\File::getTmpPath() . $prefix . '.zip';
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              if (\App\Fields\File::isExistsUrl($url)) {
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

                          (new \vtlib\Language())->import($path);
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           */
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           * @param string $prefix
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           */
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          }
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              try {
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

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

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

                      if (\file_exists($path)) {
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

                          \unlink($path);
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          }
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           * @return bool
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           */
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

                  }
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          /**
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              return $languages;
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          public static function download(string $prefix)
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

                  try {
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              } else {
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          {
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              return false;
      Severity: Minor
      Found in app/Installer/Languages.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/Installer/Languages.php by phpcodesniffer

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

           * Get last error message.
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          {
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

                  if (isset($langs[$key]) && strtotime($langs[$key]['time']) > strtotime($row['lastupdated'])) {
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           */
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

                  }
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

                          \file_put_contents($file, $response->getBody());
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              $url = "https://github.com/YetiForceCompany/YetiForceCRMLanguages/raw/master/{$endpoint}/{$prefix}.zip";
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          /**
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              foreach (\App\Language::getAll(true, true) as $key => $row) {
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          public static function getAll()
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          {
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          /**
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          private static $lastErrorMessage;
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

                      $body = \App\Json::decode($response->getBody());
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

                      }
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          /**
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           * @param string $prefix
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           */
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

          {
      Severity: Minor
      Found in app/Installer/Languages.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/Installer/Languages.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           * @var string
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

                  return [];
      Severity: Minor
      Found in app/Installer/Languages.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/Installer/Languages.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

              $endpoint = \App\Config::developer('LANGUAGES_UPDATE_DEV_MODE') ? 'Developer' : \App\Version::get();
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

                  $url = "https://github.com/YetiForceCompany/YetiForceCRMLanguages/raw/master/{$endpoint}/lang.json";
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

                              $languages[$prefix] = $row;
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

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

           * @return string|null
      Severity: Minor
      Found in app/Installer/Languages.php by phpcodesniffer

      There are no issues that match your filters.

      Category
      Status