YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/CurrencyUpdate/bankmodels/NBP.php

Summary

Maintainability
D
2 days
Test Coverage
C
74%

Function getRates has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

    public function getRates($otherCurrencyCode, $dateParam, $cron = false)
    {
        $moduleModel = Settings_CurrencyUpdate_Module_Model::getCleanInstance();
        $selectedBank = $moduleModel->getActiveBankId();
        $yesterday = date('Y-m-d', strtotime('-1 day'));
Severity: Minor
Found in modules/Settings/CurrencyUpdate/bankmodels/NBP.php - About 7 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function getSupportedCurrencies has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    public function getSupportedCurrencies()
    {
        $supportedCurrencies = [];
        $supportedCurrencies[Settings_CurrencyUpdate_Module_Model::getCRMCurrencyName($this->getMainCurrencyCode())] = $this->getMainCurrencyCode();
        $dateCur = date('Y-m-d', strtotime('last monday'));
Severity: Minor
Found in modules/Settings/CurrencyUpdate/bankmodels/NBP.php - About 4 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method getRates has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getRates($otherCurrencyCode, $dateParam, $cron = false)
    {
        $moduleModel = Settings_CurrencyUpdate_Module_Model::getCleanInstance();
        $selectedBank = $moduleModel->getActiveBankId();
        $yesterday = date('Y-m-d', strtotime('-1 day'));
Severity: Major
Found in modules/Settings/CurrencyUpdate/bankmodels/NBP.php - About 3 hrs to fix

    Method getSupportedCurrencies has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getSupportedCurrencies()
        {
            $supportedCurrencies = [];
            $supportedCurrencies[Settings_CurrencyUpdate_Module_Model::getCRMCurrencyName($this->getMainCurrencyCode())] = $this->getMainCurrencyCode();
            $dateCur = date('Y-m-d', strtotime('last monday'));
    Severity: Minor
    Found in modules/Settings/CurrencyUpdate/bankmodels/NBP.php - About 1 hr to fix

      The method getRates() has an NPath complexity of 44000. The configured NPath complexity threshold is 200.
      Open

          public function getRates($otherCurrencyCode, $dateParam, $cron = false)
          {
              $moduleModel = Settings_CurrencyUpdate_Module_Model::getCleanInstance();
              $selectedBank = $moduleModel->getActiveBankId();
              $yesterday = date('Y-m-d', strtotime('-1 day'));

      NPathComplexity

      Since: 0.1

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

      Example

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

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

      The method getSupportedCurrencies() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
      Open

          public function getSupportedCurrencies()
          {
              $supportedCurrencies = [];
              $supportedCurrencies[Settings_CurrencyUpdate_Module_Model::getCRMCurrencyName($this->getMainCurrencyCode())] = $this->getMainCurrencyCode();
              $dateCur = date('Y-m-d', strtotime('last monday'));

      CyclomaticComplexity

      Since: 0.1

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

      Example

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

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

      The method getRates() has a Cyclomatic Complexity of 27. The configured cyclomatic complexity threshold is 10.
      Open

          public function getRates($otherCurrencyCode, $dateParam, $cron = false)
          {
              $moduleModel = Settings_CurrencyUpdate_Module_Model::getCleanInstance();
              $selectedBank = $moduleModel->getActiveBankId();
              $yesterday = date('Y-m-d', strtotime('-1 day'));

      CyclomaticComplexity

      Since: 0.1

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

      Example

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

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

      Refactor this function to reduce its Cognitive Complexity from 28 to the 15 allowed.
      Open

          public function getSupportedCurrencies()

      Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

      See

      Refactor this function to reduce its Cognitive Complexity from 55 to the 15 allowed.
      Open

          public function getRates($otherCurrencyCode, $dateParam, $cron = false)

      Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

      See

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

                      $tryTable = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->get($url, ['timeout' => 20, 'connect_timeout' => 10]);

      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 '57', column '16').
      Open

                          throw new \App\Exceptions\IntegrationException('ERR_ITERATIONS_LIMIT_EXCEEDED');

      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 '118', column '22').
      Open

                      $tryTable = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->get($url, ['timeout' => 20, 'connect_timeout' => 10]);

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

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

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

          public function getRates($otherCurrencyCode, $dateParam, $cron = false)

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

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

      Missing class import via use statement (line '77', column '14').
      Open

                  throw new \App\Exceptions\IntegrationException('ERR_CANNOT_CONNECT_TO_REMOTE' . $tableBody);

      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 'Settings_CurrencyUpdate_Module_Model' in method 'getSupportedCurrencies'.
      Open

                          $supportedCurrencies[Settings_CurrencyUpdate_Module_Model::getCRMCurrencyName($rawCurrency['code'])] = $rawCurrency['code'];

      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_CurrencyUpdate_Module_Model' in method 'getRates'.
      Open

              $moduleModel = Settings_CurrencyUpdate_Module_Model::getCleanInstance();

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

                  } else {
                      \App\Log::error('Cannot parse server response' . $tableBody, __METHOD__);
                  }

      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\Log' in method 'getRates'.
      Open

                      \App\Log::endProfile("GET|NBP|{$url}", __NAMESPACE__);

      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_CurrencyUpdate_Module_Model' in method 'getSupportedCurrencies'.
      Open

              $supportedCurrencies[Settings_CurrencyUpdate_Module_Model::getCRMCurrencyName($this->getMainCurrencyCode())] = $this->getMainCurrencyCode();

      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 'getSupportedCurrencies'.
      Open

                      $tryTable = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->get($url, ['timeout' => 20, 'connect_timeout' => 10]);

      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 'getSupportedCurrencies'.
      Open

                      \App\Log::endProfile("GET|NBP::getSupportedCurrencies|{$url}", 'CurrencyUpdate');

      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 'getRates'.
      Open

              $json = \App\Json::decode($tableBody);

      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 'getRates'.
      Open

                      $tryTable = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->get($url, ['timeout' => 20, 'connect_timeout' => 10]);

      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 'getSupportedCurrencies'.
      Open

                  $json = \App\Json::decode($tableBody);

      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\Currency' in method 'getRates'.
      Open

      }

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

                      } else {
                          $moduleModel->addCurrencyRate($mainCurrencyId, $datePublicationOfFile, $exchange, $selectedBank);
                      }

      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\Log' in method 'getSupportedCurrencies'.
      Open

                      \App\Log::beginProfile("GET|NBP::getSupportedCurrencies|{$url}", 'CurrencyUpdate');

      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 'vtlib\Functions' in method 'getRates'.
      Open

              $lastWorkingDay = vtlib\Functions::getLastWorkingDay($yesterday);

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

                          } else {
                              $moduleModel->addCurrencyRate($currId, $datePublicationOfFile, $exchange, $selectedBank);
                          }

      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\Log' in method 'getSupportedCurrencies'.
      Open

                      \App\Log::info('Error during downloading table: ' . PHP_EOL . $ex->__toString() . PHP_EOL, 'CurrencyUpdate');

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

              } else {
                  throw new \App\Exceptions\IntegrationException('ERR_CANNOT_CONNECT_TO_REMOTE' . $tableBody);
              }

      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\Log' in method 'getSupportedCurrencies'.
      Open

                      \App\Log::error('Cannot parse server response' . $tableBody, __METHOD__);

      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 'getRates'.
      Open

                      \App\Log::beginProfile("GET|NBP|{$url}", __NAMESPACE__);

      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 "Y-m-d" 5 times.
      Open

              $dateCur = date('Y-m-d', strtotime('last monday'));

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

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

      Noncompliant Code Example

      With the default threshold of 3:

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

      Compliant Solution

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

      Exceptions

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

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

                      \App\Log::beginProfile("GET|NBP::getSupportedCurrencies|{$url}", 'CurrencyUpdate');

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

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

      Noncompliant Code Example

      With the default threshold of 3:

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

      Compliant Solution

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

      Exceptions

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

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

                  if (!empty($json) && !empty($json[0]) && !empty($json[0]['rates'])) {

      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.

      Avoid using empty try-catch blocks in getRates.
      Open

                  } catch (\Throwable $exc) {
                  }

      EmptyCatchBlock

      Since: 2.7.0

      Usually empty try-catch is a bad idea because you are silently swallowing an error condition and then continuing execution. Occasionally this may be the right thing to do, but often it's a sign that a developer saw an exception, didn't know what to do about it, and so used an empty catch to silence the problem.

      Example

      class Foo {
      
        public function bar()
        {
            try {
                // ...
            } catch (Exception $e) {} // empty catch block
        }
      }

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

      Suspicious type null of a variable or expression used to build a string. (Expected type to be able to cast to a string)
      Open

                  throw new \App\Exceptions\IntegrationException('ERR_CANNOT_CONNECT_TO_REMOTE' . $tableBody);

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

                      $tryTable = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->get($url, ['timeout' => 20, 'connect_timeout' => 10]);

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

                      $tryTable = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->get($url, ['timeout' => 20, 'connect_timeout' => 10]);

      Saw unextractable annotation for comment '* @param <array> $currencies - list of systems active currencies'</array>
      Open

           * @param <Array> $currencies        - list of systems active currencies

      Expected @param annotation for dateParam to be before the @param annotation for cron
      Open

           * @param bool    $cron              - if true then it is fired by server and crms currency conversion rates are updated

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

                      $tryTable = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->get($url, ['timeout' => 20, 'connect_timeout' => 10]);

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

                      \App\Log::endProfile("GET|NBP|{$url}", __NAMESPACE__);

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

                      $tryTable = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->get($url, ['timeout' => 20, 'connect_timeout' => 10]);

      Saw unextractable annotation for comment '* @param <date> $date - date for which exchange is fetched'</date>
      Open

           * @param <Date>  $date              - date for which exchange is fetched

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

                      \App\Log::beginProfile("GET|NBP::getSupportedCurrencies|{$url}", 'CurrencyUpdate');

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

                      \App\Log::endProfile("GET|NBP::getSupportedCurrencies|{$url}", 'CurrencyUpdate');

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

                      \App\Log::error('Cannot parse server response' . $tableBody, __METHOD__);

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

                      \App\Log::info('Error during downloading table: ' . PHP_EOL . $ex->__toString() . PHP_EOL, 'CurrencyUpdate');

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

                      \App\Log::beginProfile("GET|NBP|{$url}", __NAMESPACE__);

      Argument 1 (encodedValue) is null but \App\Json::decode() takes string defined at /code/app/Json.php:37
      Open

              $json = \App\Json::decode($tableBody);

      Either remove or fill this block of code.
      Open

                  } catch (\Throwable $exc) {
                  }

      Most of the time a block of code is empty when a piece of code is really missing. So such empty block must be either filled or removed.

      Noncompliant Code Example

      for ($i = 0; $i < 42; $i++){}  // Empty on purpose or missing piece of code ?
      

      Exceptions

      When a block contains a comment, this block is not considered to be empty.

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

                  if ($mainCurrencyId) {
                      if (true === $cron || ((strtotime($dateParam) == strtotime($today)) || (strtotime($dateParam) == strtotime($lastWorkingDay)))) {
                          $moduleModel->setCRMConversionRate($this->getMainCurrencyCode(), $exchangeRate);
                      }
      
      
      Severity: Major
      Found in modules/Settings/CurrencyUpdate/bankmodels/NBP.php and 3 other locations - About 2 hrs to fix
      modules/Settings/CurrencyUpdate/bankmodels/CBR.php on lines 130..141
      modules/Settings/CurrencyUpdate/bankmodels/ECB.php on lines 158..170
      modules/Settings/CurrencyUpdate/bankmodels/NBR.php on lines 158..170

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 137.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Avoid excessively long variable names like $datePublicationOfFile. Keep variable name length under 20.
      Open

              $datePublicationOfFile = (string) $json[0]['effectiveDate'];

      LongVariable

      Since: 0.2

      Detects when a field, formal or local variable is declared with a long name.

      Example

      class Something {
          protected $reallyLongIntName = -3; // VIOLATION - Field
          public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
              $otherReallyLongName = -5; // VIOLATION - Local
              for ($interestingIntIndex = 0; // VIOLATION - For
                   $interestingIntIndex < 10;
                   $interestingIntIndex++ ) {
              }
          }
      }

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

      Each class must be in a namespace of at least one level (a top-level vendor name)
      Open

      class Settings_CurrencyUpdate_NBP_BankModel extends Settings_CurrencyUpdate_AbstractBank_Model

      The class Settings_CurrencyUpdate_NBP_BankModel is not named in CamelCase.
      Open

      class Settings_CurrencyUpdate_NBP_BankModel extends Settings_CurrencyUpdate_AbstractBank_Model
      {
          // Returns bank name
      
          public function getName()

      CamelCaseClassName

      Since: 0.2

      It is considered best practice to use the CamelCase notation to name classes.

      Example

      class class_name {
      }

      Source

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

          // Returns url sources from where exchange rates are taken from

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

              return ['http://nbp.pl/kursy/xml/LastA.xml'];

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

          {

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

                  if (!empty($json) && !empty($json[0]) && !empty($json[0]['rates'])) {

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

              return 'NBP';

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

              $supportedCurrencies = [];

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

              $tableUrl = 'http://api.nbp.pl/api/exchangerates/tables/a/';

      Line exceeds 120 characters; contains 140 characters
      Open

                      $tryTable = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->get($url, ['timeout' => 20, 'connect_timeout' => 10]);

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

                          }

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

          public function getName()

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

          {

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

          }

      Line exceeds 120 characters; contains 148 characters
      Open

              $supportedCurrencies[Settings_CurrencyUpdate_Module_Model::getCRMCurrencyName($this->getMainCurrencyCode())] = $this->getMainCurrencyCode();

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

              $iterationsLimit = 60;

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

                      \App\Log::beginProfile("GET|NBP::getSupportedCurrencies|{$url}", 'CurrencyUpdate');

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

              }

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

                              continue;

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

          public function getSupportedCurrencies()

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

              $supportedCurrencies[Settings_CurrencyUpdate_Module_Model::getCRMCurrencyName($this->getMainCurrencyCode())] = $this->getMainCurrencyCode();

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

              $numberOfDays = 1;

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

                      $dateCur = date('Y-m-d', $newDate);

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

                      foreach ($json[0]['rates'] as $rawCurrency) {

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

          // Returns list of currencies supported by this bank

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

                  try {

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

                          $tableBody = $tryTable->getBody();

      Line exceeds 120 characters; contains 125 characters
      Open

                      \App\Log::info('Error during downloading table: ' . PHP_EOL . $ex->__toString() . PHP_EOL, 'CurrencyUpdate');

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

                          throw new \App\Exceptions\IntegrationException('ERR_ITERATIONS_LIMIT_EXCEEDED');

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

          // Returns bank name

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

          }

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

                  $url = $tableUrl . $dateCur . '/?format=json';

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

                          $supportedCurrencies[Settings_CurrencyUpdate_Module_Model::getCRMCurrencyName($rawCurrency['code'])] = $rawCurrency['code'];

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

          public function getSource()

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

                      }

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

              if ($stateA && $tableBody) {

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

                      $tryTable = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->get($url, ['timeout' => 20, 'connect_timeout' => 10]);

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

                      \App\Log::info('Error during downloading table: ' . PHP_EOL . $ex->__toString() . PHP_EOL, 'CurrencyUpdate');

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

          {

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

              $dateCur = date('Y-m-d', strtotime('last monday'));

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

              $stateA = false;

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

                  }

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

              while (!$stateA) {

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

                  if (!$stateA) {

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

                              continue;

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

                      ++$numberOfDays;

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

                      }

      Line exceeds 120 characters; contains 144 characters
      Open

                          $supportedCurrencies[Settings_CurrencyUpdate_Module_Model::getCRMCurrencyName($rawCurrency['code'])] = $rawCurrency['code'];

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

                      }

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

           *

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

           * @param <Date>  $date              - date for which exchange is fetched

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

          public function getRates($otherCurrencyCode, $dateParam, $cron = false)

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

              $iterationsLimit = 60;

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

                  foreach ($json[0]['rates'] as $item) {

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

                      if ($item['code'] === $mainCurrency) {

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

                      if ($code == $this->getMainCurrencyCode()) {

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

                          $mainCurrencyId = $id;

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

                      if (200 == $tryTable->getStatusCode()) {

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

                          $stateA = true;

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

                          if (empty($rawCurrency['currency'])) {

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

                          }

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

              $tableUrl = 'http://api.nbp.pl/api/exchangerates/tables/a/';

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

                          $tableBody = $tryTable->getBody();

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

                      }

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

              foreach ($json[0]['rates'] as $item) {

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

                  $currency = $item['code'];

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

                  foreach ($otherCurrencyCode as $code => $id) {

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

                  if ($mainCurrencyId) {

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

                      if ($numberOfDays > $iterationsLimit) {

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

              }

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

              return $supportedCurrencies;

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

              $numberOfDays = 1;

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

                      ++$numberOfDays;

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

                      }

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

                      } else {

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

                      \App\Log::endProfile("GET|NBP::getSupportedCurrencies|{$url}", 'CurrencyUpdate');

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

                      $newDate = strtotime("-$numberOfDays day", strtotime($dateCur));

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

                  $json = \App\Json::decode($tableBody);

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

          public function getMainCurrencyCode()

      Line exceeds 120 characters; contains 124 characters
      Open

           * @param bool    $cron              - if true then it is fired by server and crms currency conversion rates are updated

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

                      $tryTable = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->get($url, ['timeout' => 20, 'connect_timeout' => 10]);

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

                          $exchangeRate = (float) $item['mid'];

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

                          $existingId = $moduleModel->getCurrencyRateId($currId, $datePublicationOfFile, $selectedBank);

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

                              $moduleModel->updateCurrencyRate($existingId, $exchange);

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

              }

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

                      if (true === $cron || ((strtotime($dateParam) == strtotime($today)) || (strtotime($dateParam) == strtotime($lastWorkingDay)))) {

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

                      \App\Log::error('Cannot parse server response' . $tableBody, __METHOD__);

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

              $yesterday = date('Y-m-d', strtotime('-1 day'));

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

              $dateCur = $dateParam;

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

                      \App\Log::beginProfile("GET|NBP|{$url}", __NAMESPACE__);

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

              // if currency is diffrent than PLN we need to calculate rate for converting other currencies to this one from PLN

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

                          $exchangeVtiger = $exchangeRate / $exchange;

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

              // currency diffrent than PLN, we need to add manually PLN rates

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

                  } catch (\Throwable $ex) {

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

                  }

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

                          if ('XDR' === $rawCurrency['code']) {

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

          {

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

          /**

      Line exceeds 120 characters; contains 140 characters
      Open

                      $tryTable = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->get($url, ['timeout' => 20, 'connect_timeout' => 10]);

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

                  if (false === $stateA) {

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

              }

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

                  }

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

                      }

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

                      $dateCur = date('Y-m-d', $dateCur);

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

              $datePublicationOfFile = (string) $json[0]['effectiveDate'];

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

                  $mainCurrencyId = false;

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

                      $existingId = $moduleModel->getCurrencyRateId($mainCurrencyId, $datePublicationOfFile, $selectedBank);

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

          // Returns banks main currency

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

              while (!$stateA) {

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

                  $url = $tableUrl . $dateCur . '/?format=json';

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

                  try {

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

                      \App\Log::endProfile("GET|NBP|{$url}", __NAMESPACE__);

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

                      $dateCur = strtotime("-$numberOfDays day", strtotime($dateCur));

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

                          if (true === $cron || ((strtotime($dateParam) == strtotime($today)) || (strtotime($dateParam) == strtotime($lastWorkingDay)))) {

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

                          }

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

              }

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

                  throw new \App\Exceptions\IntegrationException('ERR_CANNOT_CONNECT_TO_REMOTE' . $tableBody);

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

          }

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

           * @param mixed   $otherCurrencyCode

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

              }

      Line exceeds 120 characters; contains 148 characters
      Open

                          if (true === $cron || ((strtotime($dateParam) == strtotime($today)) || (strtotime($dateParam) == strtotime($lastWorkingDay)))) {

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

                          } else {

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

                              $moduleModel->addCurrencyRate($currId, $datePublicationOfFile, $exchange, $selectedBank);

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

                          }

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

              } else {

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

           * @param <Array> $currencies        - list of systems active currencies

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

           */

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

              // check if data is correct, currency rates can be retrieved only for working days

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

                          $stateA = true;

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

                  } catch (\Throwable $exc) {

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

                      if ($key == $currency && $currency != $mainCurrency) {

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

                          $exchange = $exchangeRate ? ($exchange / $exchangeRate) : 0;

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

                              $moduleModel->setCRMConversionRate($currency, $exchangeVtiger);

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

                          $moduleModel->addCurrencyRate($mainCurrencyId, $datePublicationOfFile, $exchange, $selectedBank);

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

              $moduleModel = Settings_CurrencyUpdate_Module_Model::getCleanInstance();

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

                  foreach ($otherCurrencyCode as $key => $currId) {

      Line exceeds 120 characters; contains 144 characters
      Open

                      if (true === $cron || ((strtotime($dateParam) == strtotime($today)) || (strtotime($dateParam) == strtotime($lastWorkingDay)))) {

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

                      }

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

          }

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

           * Fetch exchange rates.

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

          {

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

                      if ($numberOfDays > $iterationsLimit) {

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

                          break;

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

              $exchangeRate = 1.0;

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

                          $exchange = $item['mid'];

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

                  }

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

                  } else {

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

              return 'PLN';

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

           * @param bool    $cron              - if true then it is fired by server and crms currency conversion rates are updated

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

           * @param mixed   $dateParam

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

              $selectedBank = $moduleModel->getActiveBankId();

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

              $stateA = false;

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

                      }

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

                  }

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

              $lastWorkingDay = vtlib\Functions::getLastWorkingDay($yesterday);

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

              $mainCurrency = \App\Fields\Currency::getDefault()['currency_code'];

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

                      }

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

                  }

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

              if ($mainCurrency !== $this->getMainCurrencyCode()) {

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

                      }

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

                  }

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

                          $moduleModel->setCRMConversionRate($this->getMainCurrencyCode(), $exchangeRate);

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

              $today = date('Y-m-d');

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

              $json = \App\Json::decode($tableBody);

      Line exceeds 120 characters; contains 122 characters
      Open

              // if currency is diffrent than PLN we need to calculate rate for converting other currencies to this one from PLN

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

              if ($mainCurrency != $this->getMainCurrencyCode()) {

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

                  $exchange = $exchangeRate ? (1.00000 / $exchangeRate) : 0;

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

                  }

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

                      if (200 == $tryTable->getStatusCode()) {

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

                  }

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

                          if ($existingId > 0) {

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

                      if ($existingId > 0) {

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

                          $moduleModel->updateCurrencyRate($existingId, $exchange);

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

          }

      Class name "Settings_CurrencyUpdate_NBP_BankModel" is not in camel caps format
      Open

      class Settings_CurrencyUpdate_NBP_BankModel extends Settings_CurrencyUpdate_AbstractBank_Model

      There are no issues that match your filters.

      Category
      Status