YetiForceCompany/YetiForceCRM

View on GitHub
app/RecordCollectors/Helper/GusClient.php

Summary

Maintainability
B
5 hrs
Test Coverage
F
0%

Function getAdvanceData has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAdvanceData(array &$response): void
    {
        if (isset($response['Typ'], $response['SilosID']) && ($reportName = $this->getReportName($response['Typ'], $response['SilosID']))) {
            $responseFromGus = $this->getData('DanePobierzPelnyRaport', ['pRegon' => $response['Regon'], 'pNazwaRaportu' => $reportName]);
            if (empty($responseFromGus)) {
Severity: Minor
Found in app/RecordCollectors/Helper/GusClient.php - About 2 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 getAdvanceData has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getAdvanceData(array &$response): void
    {
        if (isset($response['Typ'], $response['SilosID']) && ($reportName = $this->getReportName($response['Typ'], $response['SilosID']))) {
            $responseFromGus = $this->getData('DanePobierzPelnyRaport', ['pRegon' => $response['Regon'], 'pNazwaRaportu' => $reportName]);
            if (empty($responseFromGus)) {
Severity: Major
Found in app/RecordCollectors/Helper/GusClient.php - About 2 hrs to fix

    Method __doRequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function __doRequest($req, $location, $action, $version = SOAP_1_2, $oneWay = null): string
    Severity: Minor
    Found in app/RecordCollectors/Helper/GusClient.php - About 35 mins to fix

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

          public function getAdvanceData(array &$response): void
          {
              if (isset($response['Typ'], $response['SilosID']) && ($reportName = $this->getReportName($response['Typ'], $response['SilosID']))) {
                  $responseFromGus = $this->getData('DanePobierzPelnyRaport', ['pRegon' => $response['Regon'], 'pNazwaRaportu' => $reportName]);
                  if (empty($responseFromGus)) {

      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 21 to the 15 allowed.
      Open

          public function getAdvanceData(array &$response): void

      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

      Avoid using undefined variables such as '$header' which will lead to PHP notices.
      Open

                  $this->__setSoapHeaders($header);

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

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

      Avoid using undefined variables such as '$header' which will lead to PHP notices.
      Open

                          $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'To', self::CONFIG['addressToService'], 0);

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

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

      Avoid using undefined variables such as '$header' which will lead to PHP notices.
      Open

                          $this->__setSoapHeaders($header);

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

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

      Avoid using undefined variables such as '$header' which will lead to PHP notices.
      Open

                          $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'Action', $this->getAddressToAction('Wyloguj'), 0);

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

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

      Avoid using undefined variables such as '$header' which will lead to PHP notices.
      Open

                  $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'To', self::CONFIG['addressToService'], 0);

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

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

      Avoid using undefined variables such as '$header' which will lead to PHP notices.
      Open

                  $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'Action', $this->getAddressToAction('Zaloguj'), 0);

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

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

      Avoid using undefined variables such as '$header' which will lead to PHP notices.
      Open

              $this->__setSoapHeaders($header);

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

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

      Avoid using undefined variables such as '$header' which will lead to PHP notices.
      Open

              $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'Action', $this->getAddressToAction($type), true);

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

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

      Avoid using undefined variables such as '$header' which will lead to PHP notices.
      Open

              $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'To', self::CONFIG['addressToService'], true);

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

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

      Missing class import via use statement (line '159', column '20').
      Open

                  $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'To', self::CONFIG['addressToService'], 0);

      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 '204', column '19').
      Open

              $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'To', self::CONFIG['addressToService'], true);

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

                          $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'To', self::CONFIG['addressToService'], 0);

      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 '203', column '19').
      Open

              $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'Action', $this->getAddressToAction($type), true);

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

                          $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'Action', $this->getAddressToAction('Wyloguj'), 0);

      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 '158', column '20').
      Open

                  $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'Action', $this->getAddressToAction('Zaloguj'), 0);

      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\RequestHttp' in method 'getInstance'.
      Open

              $options = \App\RequestHttp::getSoapOptions();

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

                          \App\Log::error($e->getMessage() . PHP_EOL . $e->__toString());

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

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

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

          public function getAdvanceData(array &$response): void
          {
              if (isset($response['Typ'], $response['SilosID']) && ($reportName = $this->getReportName($response['Typ'], $response['SilosID']))) {
                  $responseFromGus = $this->getData('DanePobierzPelnyRaport', ['pRegon' => $response['Regon'], 'pNazwaRaportu' => $reportName]);
                  if (empty($responseFromGus)) {

      IfStatementAssignment

      Since: 2.7.0

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

      Example

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

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

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

              $cacheKey = \App\Json::encode($params);

      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\Purifier' in method 'parseResponse'.
      Open

                  $fields[$val[2]] = \App\Purifier::decodeHtml($val[3]);

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

                          } else {
                              $additional[] = "{$value[$prefixName . 'pkdKod']} - {$name}";
                          }

      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

      The method getAdvanceData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

              } else {
                  $response = [];
              }

      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

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

              'BIR11OsFizycznaDzialalnoscCeidg' => 'BIR11OsFizycznaPkd',

      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 "Regon" 4 times.
      Open

              $response = $this->getData('DaneSzukajPodmioty', ['pParametryWyszukiwania' => ['Nip' => $vatId,  'Krs' => $ncr, 'Regon' => $taxNumber]]);

      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 "UTF-8" 3 times.
      Open

                  $response['PodstawowaFormaPrawnaNazwa'] = mb_convert_case($responseFromGus[$prefixName . 'podstawowaFormaPrawna_Nazwa'] ?? '', MB_CASE_TITLE, 'UTF-8');

      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 "BIR11OsPrawna" 4 times.
      Open

              'P' => 'BIR11OsPrawna',

      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 "BIR11OsFizycznaDzialalnoscPozostala" 3 times.
      Open

                  '3' => 'BIR11OsFizycznaDzialalnoscPozostala',

      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 "BIR11JednLokalnaOsPrawnej" 3 times.
      Open

              'LP' => 'BIR11JednLokalnaOsPrawnej',

      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 "fiz_adSiedzNumerNieruchomosci" 4 times.
      Open

              'BIR11OsFizycznaDzialalnoscSkreslonaDo20141108' => 'fiz_adSiedzNumerNieruchomosci',

      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 "BIR11OsFizycznaDzialalnoscSkreslonaDo20141108" 4 times.
      Open

                  '4' => 'BIR11OsFizycznaDzialalnoscSkreslonaDo20141108',

      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 "pRegon" 3 times.
      Open

                  $responseFromGus = $this->getData('DanePobierzPelnyRaport', ['pRegon' => $response['Regon'], 'pNazwaRaportu' => $reportName]);

      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 "BIR11OsFizycznaDzialalnoscCeidg" 3 times.
      Open

                  '1' => 'BIR11OsFizycznaDzialalnoscCeidg',

      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 "Action" 3 times.
      Open

                  $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'Action', $this->getAddressToAction('Zaloguj'), 0);

      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 "addressToService" 5 times.
      Open

              'addressToService' => 'https://wyszukiwarkaregon.stat.gov.pl/wsBIR/UslugaBIRzewnPubl.svc',

      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 "BIR11OsFizycznaDzialalnoscRolnicza" 3 times.
      Open

                  '2' => 'BIR11OsFizycznaDzialalnoscRolnicza',

      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 "pNazwaRaportu" 3 times.
      Open

                  $responseFromGus = $this->getData('DanePobierzPelnyRaport', ['pRegon' => $response['Regon'], 'pNazwaRaportu' => $reportName]);

      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 with 2 arg(s) to \App\RecordCollectors\Helper\GusClient::__construct() which only takes 0 arg(s) defined at /code/app/RecordCollectors/Helper/GusClient.php:22
      Open

              $instance = new self(self::CONFIG['addressToWsdl'], $options);

      When fetching an array index from a value of type array{1:'BIR11OsFizycznaDzialalnoscCeidg',2:'BIR11OsFizycznaDzialalnoscRolnicza',3:'BIR11OsFizycznaDzialalnoscPozostala',4:'BIR11OsFizycznaDzialalnoscSkreslonaDo20141108'}, found an array index of type string, but expected the index to be of type int
      Open

                  $name = self::REPORT_NAME[$type][$silosId];

      Variable $header was undeclared, but array fields are being added to it.
      Open

                          $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'Action', $this->getAddressToAction('Wyloguj'), 0);

      Argument 4 (mustunderstand) is 0 but \SoapHeader::__construct() takes bool
      Open

                          $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'To', self::CONFIG['addressToService'], 0);

      Reference to undeclared property \App\RecordCollectors\Helper\GusClient->register
      Open

                  $this->register = true;

      Variable $header was undeclared, but array fields are being added to it.
      Open

                  $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'Action', $this->getAddressToAction('Zaloguj'), 0);

      Argument 4 (mustunderstand) is 0 but \SoapHeader::__construct() takes bool
      Open

                  $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'To', self::CONFIG['addressToService'], 0);

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

                          \App\Log::error($e->getMessage() . PHP_EOL . $e->__toString());
      Severity: Critical
      Found in app/RecordCollectors/Helper/GusClient.php by phan

      Argument 4 (mustunderstand) is 0 but \SoapHeader::__construct() takes bool
      Open

                          $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'Action', $this->getAddressToAction('Wyloguj'), 0);

      Variable $header was undeclared, but array fields are being added to it.
      Open

              $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'Action', $this->getAddressToAction($type), true);

      Argument 4 (mustunderstand) is 0 but \SoapHeader::__construct() takes bool
      Open

                  $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'Action', $this->getAddressToAction('Zaloguj'), 0);

      Reference to undeclared property \App\RecordCollectors\Helper\GusClient->register
      Open

              if (empty($this->register)) {

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

                  '3' => 'BIR11OsFizycznaDzialalnoscPozostala',

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

              'BIR11OsPrawna' => 'praw_adSiedzNumerNieruchomosci',

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

          /** @var self[] Namespace for header. */

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

           *

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

              'LF' => 'BIR11OsFizycznaDzialalnoscSkreslonaDo20141108',

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

              'addressToWsdl' => 'https://wyszukiwarkaregon.stat.gov.pl/wsBIR/wsdl/UslugaBIRzewnPubl-ver11-prod.wsdl',

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

          private $streamContext;

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

                  '1' => 'BIR11OsFizycznaDzialalnoscCeidg',

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

          /** @var string[] Mapping field from report to number local field in record. */

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

          ];

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

          const PKD_REPORTS = [

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

          const HEADER_NAMESPACE = 'http://www.w3.org/2005/08/addressing';

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

          const REPORT_TO_NUMBER_LOCAL = [

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

              'BIR11OsPrawna' => 'praw_',

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

          ];

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

              'BIR11OsFizycznaDzialalnoscRolnicza' => 'BIR11OsFizycznaPkd',

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

          private $params;

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

          /**

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

          const REPORT_NAME = [

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

              'F' => [

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

                  '2' => 'BIR11OsFizycznaDzialalnoscRolnicza',

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

              'P' => 'BIR11OsPrawna',

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

              'BIR11JednLokalnaOsPrawnej' => 'BIR11JednLokalnaOsPrawnejPkd',

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

          /** @var array Params. */

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

           * Get instance.

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

              'BIR11OsFizycznaDzialalnoscPozostala' => 'fiz_adSiedzNumerNieruchomosci',

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

              'BIR11OsFizycznaDzialalnoscSkreslonaDo20141108' => 'BIR11OsFizycznaPkd',

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

          ];

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

          /** @var string Client session. */

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

              ],

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

              'BIR11OsFizycznaDzialalnoscCeidg' => 'fiz_adSiedzNumerNieruchomosci',

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

              'BIR11OsFizycznaDzialalnoscCeidg' => 'BIR11OsFizycznaPkd',

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

          /** @var array Report names for entity. */

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

              'addressToService' => 'https://wyszukiwarkaregon.stat.gov.pl/wsBIR/UslugaBIRzewnPubl.svc',

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

          public static $cache = [];

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

              'BIR11OsFizycznaDzialalnoscRolnicza' => 'fiz_adSiedzNumerNieruchomosci',

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

          /** @var string[] PKD report map. */

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

          const CONFIG = [

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

          private $sessionId;

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

          /** @var string[] Client connection details. */

      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

           * @return self

      Line exceeds 120 characters; contains 182 characters
      Open

       * The file is part of the paid functionality. Using the file is allowed only after purchasing a subscription. File modification allowed only with the consent of the system producer.

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

                  '4' => 'BIR11OsFizycznaDzialalnoscSkreslonaDo20141108',

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

              'LP' => 'BIR11JednLokalnaOsPrawnej',

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

          /** @var string[] Variable for mapping report names to value prefix. */

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

          const REPORT_PREFIX = [

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

           * @param array $params

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

              'BIR11JednLokalnaOsPrawnej' => 'lokpraw_',

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

          /** @var string Namespace for header. */

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

              'apiKey' => 'd2df36a7394c432e88ea',

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

          ];

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

              'BIR11OsFizycznaDzialalnoscSkreslonaDo20141108' => 'fiz_adSiedzNumerNieruchomosci',

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

              'BIR11OsPrawna' => 'BIR11OsPrawnaPkd',

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

              'BIR11OsFizycznaDzialalnoscPozostala' => 'BIR11OsFizycznaPkd',

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

          /** @var resource Stream context. */

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

           */

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

              $options['stream_context'] = $context;

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

           * @param string $action

      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

           * End session - logout.

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

          public function endSession()

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

                          $this->__setSoapHeaders();

      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 (isset($response['Typ'], $response['SilosID']) && ($reportName = $this->getReportName($response['Typ'], $response['SilosID']))) {

      Line exceeds 120 characters; contains 140 characters
      Open

              if (isset($response['Typ'], $response['SilosID']) && ($reportName = $this->getReportName($response['Typ'], $response['SilosID']))) {

      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($this->sessionId)) {

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

                  $this->sessionId = $result->ZalogujResult;

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

           */

      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

                          $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'To', self::CONFIG['addressToService'], 0);

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

                          $this->Wyloguj(['pIdentyfikatorSesji' => $this->sessionId]);

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

           * @return array

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

          public function getAdvanceData(array &$response): void

      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 string $response

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

           * @return void

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

          {

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

              $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'Action', $this->getAddressToAction($type), true);

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

          public static function getInstance(array $params = []): self

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

              $instance->params = $params;

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

          /** {@inheritdoc} */

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

              $response = parent::__doRequest($req, self::CONFIG['addressToService'], $action, $version);

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

              return $totalFields;

      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 $e;

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

           * @param string|null $ncr

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

              foreach ($response as &$info) {

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

                  $responseFromGus = $this->getData('DanePobierzPelnyRaport', ['pRegon' => $response['Regon'], 'pNazwaRaportu' => $reportName]);

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

                  return self::$cache[$cacheKey];

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

              $context = stream_context_create([]);

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

              }

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

           * Start session - login.

      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 (!$vatId && !$taxNumber && !$ncr) {

      Line exceeds 120 characters; contains 145 characters
      Open

              $response = $this->getData('DaneSzukajPodmioty', ['pParametryWyszukiwania' => ['Nip' => $vatId,  'Krs' => $ncr, 'Regon' => $taxNumber]]);

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

              }

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

              $instance->streamContext = $context;

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

          {

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

                  $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'Action', $this->getAddressToAction('Zaloguj'), 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

           * @param array  $params

      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

              $options['soap_version'] = SOAP_1_2;

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

           *

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

                      $totalFields[] = $fields;

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

                  $fields[$val[2]] = \App\Purifier::decodeHtml($val[3]);

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

                  $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'To', self::CONFIG['addressToService'], 0);

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

                          $this->__setSoapHeaders($header);

      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

           * Get data from API.

      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

                  return [];

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

              $options = \App\RequestHttp::getSoapOptions();

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

           */

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

                  $this->__setSoapHeaders($header);

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

              $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'To', self::CONFIG['addressToService'], true);

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

           * @param string|null $vatId

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

           * @param array $response

      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 string

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

          public function getAddressToAction(string $action): string

      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 'http://CIS/BIR/PUBL/2014/07/IUslugaBIRzewnPubl/' . $action;

      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 123 characters
      Open

                          $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'Action', $this->getAddressToAction('Wyloguj'), 0);

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

          public function getData(string $type, array $params): array

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

              $this->__setSoapHeaders($header);

      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 search(?string $vatId, ?string $ncr = null, ?string $taxNumber = null): array

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

              $options['encoding'] = 'utf-8';

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

           *

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

              $totalFields = $fields = [];

      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 string $type

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

              return $this->parseResponse($result->{"{$type}Result"});

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

              if (isset(self::$cache[$cacheKey])) {

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

              return self::$cache[$cacheKey] = $instance;

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

                          $header[] = new \SoapHeader(self::HEADER_NAMESPACE, 'Action', $this->getAddressToAction('Wyloguj'), 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

              $result = $this->{$type}($params);

      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

                  $this->getAdvanceData($info);

      Line exceeds 120 characters; contains 138 characters
      Open

                  $responseFromGus = $this->getData('DanePobierzPelnyRaport', ['pRegon' => $response['Regon'], 'pNazwaRaportu' => $reportName]);

      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 __doRequest($req, $location, $action, $version = SOAP_1_2, $oneWay = null): string

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

          {

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

              preg_match('/<s:Envelope.*<\\/s:Envelope>/s', $response, $matches);

      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 array

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

          public function parseResponse(string $response): array

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

              $totalFields[] = $fields;

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

           *

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

           * Search entity.

      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 $matches[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

           * Parsing response.

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

              foreach ($matches as $val) {

      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($this->register)) {

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

                      } catch (\Throwable $e) {

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

                  $this->startSession();

      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

           * Get data for record fields from gus reports.

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

                      $fields = [];

      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

                  $result = $this->Zaloguj(['pKluczUzytkownika' => self::CONFIG['apiKey']]);

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

              if (empty($this->sessionId)) {

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

              $this->endSession();

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

              return $response;

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

           *

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

           * Get address to action.

      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 (isset($fields[$val[2]])) {

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

          public function startSession()

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

                  register_shutdown_function(function () {

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

                          \App\Log::error($e->getMessage() . PHP_EOL . $e->__toString());

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

              stream_context_set_option($this->streamContext, ['http' => ['header' => 'sid: ' . $this->sessionId]]);

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

              $this->__setSoapHeaders();

      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 void

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

          {

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

              $cacheKey = \App\Json::encode($params);

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

              $instance = new self(self::CONFIG['addressToWsdl'], $options);

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

           *

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

              preg_match_all('/(<([\\w]+)[^>]*>)(.*?)(<\\/\\2>)/', $response, $matches, PREG_SET_ORDER);

      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 void

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

                  $this->register = true;

      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

          }

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

           * @param string|null $taxNumber

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

           * @return array

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

              }

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

              $response = $this->getData('DaneSzukajPodmioty', ['pParametryWyszukiwania' => ['Nip' => $vatId,  'Krs' => $ncr, 'Regon' => $taxNumber]]);

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

                  $response['NumerBudynku'] = $responseFromGus[self::REPORT_TO_NUMBER_LOCAL[$reportName]] ?? '';

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

                  $response['DataZawieszeniaDzialalnosci'] = $responseFromGus[$prefixName . 'dataZawieszeniaDzialalnosci'] ?? '';

      Line exceeds 120 characters; contains 141 characters
      Open

                      $result = $this->DanePobierzPelnyRaport(['pRegon' => $response['Regon'], 'pNazwaRaportu' => self::PKD_REPORTS[$reportName]]);

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

                          if ($value[$prefixName . 'pkdPrzewazajace']) {

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

                              $additional[] = "{$value[$prefixName . 'pkdKod']} - {$name}";

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

              $name = '';

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

              } elseif (isset(self::REPORT_NAME[$type])) {

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

                  $prefixName = self::REPORT_PREFIX[$reportName] ?? 'fiz_';

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

                      $responseFromGusFiz = $this->parseResponse($resultFiz->DanePobierzPelnyRaportResult);

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

                  $response['SzczegolnaFormaPrawnaNazwa'] = mb_convert_case($responseFromGus[$prefixName . 'szczegolnaFormaPrawna_Nazwa'] ?? '', MB_CASE_TITLE, 'UTF-8');

      Line exceeds 120 characters; contains 135 characters
      Open

                  $response['SzczegolnaFormaPrawna'] = "{$response['SzczegolnaFormaPrawnaKod']} - {$response['SzczegolnaFormaPrawnaNazwa']}";

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

                  if (\in_array('pkd', $this->params)) {

      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

          }

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

                      $responseFromGusFiz = reset($responseFromGusFiz);

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

                  $response['NumerFaksu'] = $responseFromGus[$prefixName . 'numerFaksu'] ?? '';

      Line exceeds 120 characters; contains 130 characters
      Open

                  $response['AdresStronyInternetowej'] = mb_strtolower($responseFromGus[$prefixName . 'adresStronyinternetowej'] ?? '');

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

                  $response['DataWpisuDoRejestruEwidencji'] = $responseFromGus[$prefixName . 'dataWpisuDoRejestruEwidencji'] ?? '';

      Line exceeds 120 characters; contains 125 characters
      Open

                  $response['DataWpisuDoRejestruEwidencji'] = $responseFromGus[$prefixName . 'dataWpisuDoRejestruEwidencji'] ?? '';

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

                  if (empty($responseFromGus)) {

      Line exceeds 120 characters; contains 141 characters
      Open

                      $resultFiz = $this->DanePobierzPelnyRaport(['pRegon' => $response['Regon'], 'pNazwaRaportu' => 'BIR11OsFizycznaDaneOgolne']);

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

                  $response['DataZakonczeniaDzialalnosci'] = $responseFromGus[$prefixName . 'dataZakonczeniaDzialalnosci'] ?? '';

      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;

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

                  $response['PodstawowaFormaPrawnaKod'] = $responseFromGus[$prefixName . 'podstawowaFormaPrawna_Symbol'] ?? '';

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

                  $response['DataWznowieniaDzialalnosci'] = $responseFromGus[$prefixName . 'dataWznowieniaDzialalnosci'] ?? '';

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

                      $responseFromGus = array_merge($responseFromGus, $responseFromGusFiz);

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

                              $response['PKDPodstawowyNazwa'] = $name;

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

                  $name = self::REPORT_NAME[$type];

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

                  $response['Kraj'] = 'POLSKA' === $response['Kraj'] ? 'Poland' : $response['Kraj'];

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

                  $response['PodstawowaFormaPrawna'] = "{$response['PodstawowaFormaPrawnaKod']} - {$response['PodstawowaFormaPrawnaNazwa']}";

      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

              return $name;

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

                  $response['FormaFinansowania'] = $responseFromGus[$prefixName . 'formaFinansowania_Nazwa'] ?? '';

      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 121 characters
      Open

                  $response['PodstawowaFormaPrawnaKod'] = $responseFromGus[$prefixName . 'podstawowaFormaPrawna_Symbol'] ?? '';

      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

                      $additional = [];

      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 string $type

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

           * @return string

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

                  $response['NumerTelefonu'] = $responseFromGus[$prefixName . 'numerTelefonu'] ?? '';

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

                  $response['PodstawowaFormaPrawnaNazwa'] = mb_convert_case($responseFromGus[$prefixName . 'podstawowaFormaPrawna_Nazwa'] ?? '', MB_CASE_TITLE, 'UTF-8');

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

                  $response['DataSkresleniazRegon'] = $responseFromGus[$prefixName . 'dataSkresleniazRegon'] ?? '';

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

                  if (isset($responseFromGus[$prefixName . 'nip'])) {

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

                      $response['Nip'] = $responseFromGus[$prefixName . 'nip'];

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

                      $response['PKDPozostale'] = implode(' ## ', $additional);

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

              if ('F' === $type && isset(self::REPORT_NAME[$type][$silosId])) {

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

                  $name = self::REPORT_NAME[$type][$silosId];

      Line exceeds 120 characters; contains 163 characters
      Open

                  $response['PodstawowaFormaPrawnaNazwa'] = mb_convert_case($responseFromGus[$prefixName . 'podstawowaFormaPrawna_Nazwa'] ?? '', MB_CASE_TITLE, 'UTF-8');

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

                  $response['DataRozpoczeciaDzialalnosci'] = $responseFromGus[$prefixName . 'dataRozpoczeciaDzialalnosci'] ?? '';

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

                  $response['FormaWlasnosci'] = $responseFromGus[$prefixName . 'formaWlasnosci_Nazwa'] ?? '';

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

                  $response['DataPowstania'] = $responseFromGus[$prefixName . 'dataPowstania'] ?? '';

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

                  $response['DataWpisuDoREGON'] = $responseFromGus[$prefixName . 'dataWpisuDoREGON'] ?? '';

      Line exceeds 120 characters; contains 123 characters
      Open

                  $response['DataZawieszeniaDzialalnosci'] = $responseFromGus[$prefixName . 'dataZawieszeniaDzialalnosci'] ?? '';

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

                  }

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

           * Undocumented function.

      Line exceeds 120 characters; contains 163 characters
      Open

                  $response['SzczegolnaFormaPrawnaNazwa'] = mb_convert_case($responseFromGus[$prefixName . 'szczegolnaFormaPrawna_Nazwa'] ?? '', MB_CASE_TITLE, 'UTF-8');

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

                  $response['SzczegolnaFormaPrawnaKod'] = $responseFromGus[$prefixName . 'szczegolnaFormaPrawna_Symbol'] ?? '';

      Line exceeds 120 characters; contains 121 characters
      Open

                  $response['SzczegolnaFormaPrawnaKod'] = $responseFromGus[$prefixName . 'szczegolnaFormaPrawna_Symbol'] ?? '';

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

                      $result = $this->DanePobierzPelnyRaport(['pRegon' => $response['Regon'], 'pNazwaRaportu' => self::PKD_REPORTS[$reportName]]);

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

                      $resultFiz = $this->DanePobierzPelnyRaport(['pRegon' => $response['Regon'], 'pNazwaRaportu' => 'BIR11OsFizycznaDaneOgolne']);

      Line exceeds 120 characters; contains 135 characters
      Open

                  $response['PodstawowaFormaPrawna'] = "{$response['PodstawowaFormaPrawnaKod']} - {$response['PodstawowaFormaPrawnaNazwa']}";

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

                  $response['DataZaistnieniaZmiany'] = $responseFromGus[$prefixName . 'dataZaistnieniaZmiany'] ?? '';

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

                      foreach ($this->parseResponse($result->DanePobierzPelnyRaportResult) as $value) {

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

                              $response['PKDPodstawowyKod'] = $value[$prefixName . 'pkdKod'];

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

          }

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

                  $responseFromGus = reset($responseFromGus);

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

                  }

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

                  $response['AdresEmail'] = mb_strtolower($responseFromGus[$prefixName . 'adresEmail'] ?? '');

      Line exceeds 120 characters; contains 123 characters
      Open

                  $response['DataRozpoczeciaDzialalnosci'] = $responseFromGus[$prefixName . 'dataRozpoczeciaDzialalnosci'] ?? '';

      Line exceeds 120 characters; contains 121 characters
      Open

                  $response['DataWznowieniaDzialalnosci'] = $responseFromGus[$prefixName . 'dataWznowieniaDzialalnosci'] ?? '';

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

                  $response = [];

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

           */

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

          private function getReportName(string $type, string $silosId): string

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

                  $response['NumerLokalu'] = $responseFromGus[$prefixName . 'adSiedzNumerLokalu'] ?? '';

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

                  $response['Krs'] = $responseFromGus[$prefixName . 'numerWrejestrzeEwidencji'] ?? '';

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

                  $response['Kraj'] = $responseFromGus[$prefixName . 'adSiedzKraj_Nazwa'] ?? '';

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

                  $response['AdresStronyInternetowej'] = mb_strtolower($responseFromGus[$prefixName . 'adresStronyinternetowej'] ?? '');

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

                  $response['SzczegolnaFormaPrawna'] = "{$response['SzczegolnaFormaPrawnaKod']} - {$response['SzczegolnaFormaPrawnaNazwa']}";

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

                          $name = mb_convert_case($value[$prefixName . 'pkdNazwa'] ?? '', MB_CASE_TITLE, 'UTF-8');

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

           * @param string $silosId

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

                  if ('fiz_' === $prefixName) {

      Line exceeds 120 characters; contains 123 characters
      Open

                  $response['DataZakonczeniaDzialalnosci'] = $responseFromGus[$prefixName . 'dataZakonczeniaDzialalnosci'] ?? '';

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

          /**

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

           *

      The method __doRequest is not named in camelCase.
      Open

          public function __doRequest($req, $location, $action, $version = SOAP_1_2, $oneWay = null): string
          {
              $response = parent::__doRequest($req, self::CONFIG['addressToService'], $action, $version);
              preg_match('/<s:Envelope.*<\\/s:Envelope>/s', $response, $matches);
              return $matches[0];

      CamelCaseMethodName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name methods.

      Example

      class ClassName {
          public function get_name() {
          }
      }

      Source

      There are no issues that match your filters.

      Category
      Status