YetiForceCompany/YetiForceCRM

View on GitHub
app/Map/Address/GoogleGeocode.php

Summary

Maintainability
B
6 hrs
Test Coverage
F
0%

Function parse has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private function parse($rows)
    {
        $address = [];
        foreach ($rows as $row) {
            switch ($row['types'][0]) {
Severity: Minor
Found in app/Map/Address/GoogleGeocode.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 parse has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function parse($rows)
    {
        $address = [];
        foreach ($rows as $row) {
            switch ($row['types'][0]) {
Severity: Minor
Found in app/Map/Address/GoogleGeocode.php - About 1 hr to fix

    Method find has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function find($value)
        {
            if (empty($value) || !\App\RequestUtil::isNetConnection()) {
                return [];
            }
    Severity: Minor
    Found in app/Map/Address/GoogleGeocode.php - About 1 hr to fix

      Function find has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public function find($value)
          {
              if (empty($value) || !\App\RequestUtil::isNetConnection()) {
                  return [];
              }
      Severity: Minor
      Found in app/Map/Address/GoogleGeocode.php - About 55 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          private function parse($rows)
          {
              $address = [];
              foreach ($rows as $row) {
                  switch ($row['types'][0]) {
      Severity: Minor
      Found in app/Map/Address/GoogleGeocode.php by phpmd

      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

      Reduce the number of returns of this function 4, down to the maximum allowed 3.
      Open

          public function find($value)
      Severity: Major
      Found in app/Map/Address/GoogleGeocode.php by sonar-php

      Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

      Noncompliant Code Example

      With the default threshold of 3:

      function myFunction(){ // Noncompliant as there are 4 return statements
        if (condition1) {
          return true;
        } else {
          if (condition2) {
            return false;
          } else {
            return true;
          }
        }
        return false;
      }
      

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

                  throw new \App\Exceptions\AppException("ERR_COMMUNICATION_ERROR|{$body['status']}: {$body['error_message']}");
      Severity: Minor
      Found in app/Map/Address/GoogleGeocode.php by phpmd

      MissingImport

      Since: 2.7.0

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

      Example

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

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

      Missing class import via use statement (line '56', column '21').
      Open

                  $response = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->get($url);
      Severity: Minor
      Found in app/Map/Address/GoogleGeocode.php by phpmd

      MissingImport

      Since: 2.7.0

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

      Example

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

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

      Avoid using static access to class '\App\Log' in method 'find'.
      Open

                  \App\Log::warning("{$body['status']}: {$body['error_message']}", __NAMESPACE__);
      Severity: Minor
      Found in app/Map/Address/GoogleGeocode.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class '\App\Language' in method 'find'.
      Open

              $lang = \App\Language::getShortLanguageName();
      Severity: Minor
      Found in app/Map/Address/GoogleGeocode.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class '\App\Log' in method 'find'.
      Open

                  \App\Log::endProfile("GET|GoogleGeocode::find|{$url}", __NAMESPACE__);
      Severity: Minor
      Found in app/Map/Address/GoogleGeocode.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class '\App\Log' in method 'find'.
      Open

                  \App\Log::warning('Error: ' . $url . ' | ' . $exc->getMessage(), __CLASS__);
      Severity: Minor
      Found in app/Map/Address/GoogleGeocode.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class '\App\Log' in method 'find'.
      Open

                  \App\Log::beginProfile("GET|GoogleGeocode::find|{$url}", __NAMESPACE__);
      Severity: Minor
      Found in app/Map/Address/GoogleGeocode.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

                  $body = \App\Json::decode($response->getBody()->getContents());
      Severity: Minor
      Found in app/Map/Address/GoogleGeocode.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class '\App\RequestHttp' in method 'find'.
      Open

                  $response = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->get($url);
      Severity: Minor
      Found in app/Map/Address/GoogleGeocode.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

                          } else {
                              $address['buildingnumber'] = $row['long_name'];
                          }
      Severity: Minor
      Found in app/Map/Address/GoogleGeocode.php by phpmd

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

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

      Avoid using static access to class '\App\RequestUtil' in method 'find'.
      Open

              if (empty($value) || !\App\RequestUtil::isNetConnection()) {
      Severity: Minor
      Found in app/Map/Address/GoogleGeocode.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class '\App\Log' in method 'find'.
      Open

                      \App\Log::warning('Error: ' . $url . ' | ' . $response->getStatusCode() . ' ' . $response->getReasonPhrase(), __CLASS__);
      Severity: Minor
      Found in app/Map/Address/GoogleGeocode.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

              if (empty($body['error_message']) && isset($body['status'])) {
      Severity: Critical
      Found in app/Map/Address/GoogleGeocode.php by sonar-php

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

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

      Noncompliant Code Example

      With the default threshold of 3:

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

      Compliant Solution

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

      Exceptions

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

      Rename "$url" which has the same name as the field declared at line 43.
      Open

              $url = static::$url . "key={$key}&address=$value";
      Severity: Major
      Found in app/Map/Address/GoogleGeocode.php by sonar-php

      Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

      Noncompliant Code Example

      class Foo {
        public $myField;
      
        public function doSomething() {
          $myField = 0;
          ...
        }
      }
      

      See

      Define a constant instead of duplicating this literal "long_name" 12 times.
      Open

                          if (false !== strpos($row['long_name'], '/')) {
      Severity: Critical
      Found in app/Map/Address/GoogleGeocode.php by sonar-php

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

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

      Noncompliant Code Example

      With the default threshold of 3:

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

      Compliant Solution

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

      Exceptions

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

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

              if (empty($body['error_message']) && isset($body['status'])) {
      Severity: Critical
      Found in app/Map/Address/GoogleGeocode.php by sonar-php

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

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

      Noncompliant Code Example

      With the default threshold of 3:

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

      Compliant Solution

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

      Exceptions

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

      Avoid unused local variables such as '$lang'.
      Open

              $lang = \App\Language::getShortLanguageName();
      Severity: Minor
      Found in app/Map/Address/GoogleGeocode.php by phpmd

      UnusedLocalVariable

      Since: 0.2

      Detects when a local variable is declared and/or assigned, but not used.

      Example

      class Foo {
          public function doSomething()
          {
              $i = 5; // Unused
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

      Class extends undeclared class \App\Map\Address\Base (Did you mean class \App\Base or class \App\Cache\Base or class \App\Cli\Base or class \App\Controller\Base or class \App\Controller\View\Base or class \App\Db\Importers\Base or class \Tests\Base)
      Open

      class GoogleGeocode extends Base
      Severity: Critical
      Found in app/Map/Address/GoogleGeocode.php by phan

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

                  $response = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->get($url);
      Severity: Critical
      Found in app/Map/Address/GoogleGeocode.php by phan

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

                      \App\Log::warning('Error: ' . $url . ' | ' . $response->getStatusCode() . ' ' . $response->getReasonPhrase(), __CLASS__);
      Severity: Critical
      Found in app/Map/Address/GoogleGeocode.php by phan

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

                  \App\Log::warning('Error: ' . $url . ' | ' . $exc->getMessage(), __CLASS__);
      Severity: Critical
      Found in app/Map/Address/GoogleGeocode.php by phan

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

                  \App\Log::warning("{$body['status']}: {$body['error_message']}", __NAMESPACE__);
      Severity: Critical
      Found in app/Map/Address/GoogleGeocode.php by phan

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

                  \App\Log::endProfile("GET|GoogleGeocode::find|{$url}", __NAMESPACE__);
      Severity: Critical
      Found in app/Map/Address/GoogleGeocode.php by phan

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

                  $response = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->get($url);
      Severity: Critical
      Found in app/Map/Address/GoogleGeocode.php by phan

      Reference to undeclared property \App\Map\Address\GoogleGeocode->config
      Open

              $key = $this->config['key'];
      Severity: Minor
      Found in app/Map/Address/GoogleGeocode.php by phan

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

                  \App\Log::beginProfile("GET|GoogleGeocode::find|{$url}", __NAMESPACE__);
      Severity: Critical
      Found in app/Map/Address/GoogleGeocode.php by phan

      This case's code block is the same as the block for the case on line 115.
      Open

                      case 'sublocality':
                          $address['addresslevel6'] = $row['long_name'];
                          break;
      Severity: Major
      Found in app/Map/Address/GoogleGeocode.php by sonar-php

      Having two cases in a switch statement or two branches in an if chain with the same implementation is at best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then in an if chain they should be combined, or for a switch, one should fall through to the other.

      Noncompliant Code Example

      switch ($i) {
        case 1:
          doSomething();
          break;
        case 2:
          doSomethingDifferent();
          break;
        case 3:  // Noncompliant; duplicates case 1's implementation
          doSomething();
          break;
        default:
          doTheRest();
      }
      
      if ($a >= 0 && $a < 10) {
        doTheThing();
      else if ($a >= 10 && $a < 20) {
        doTheOtherThing();
      }
      else if ($a >= 20 && $a < 50) {
        doTheThing();  // Noncompliant; duplicates first condition
      }
      else {
        doTheRest();
      }
      
      if ($b == 0) {
        doOneMoreThing();
      }
      else {
        doOneMoreThing(); // Noncompliant; duplicates then-branch
      }
      
      var b = a ? 12 > 4 : 4;  // Noncompliant; always results in the same value
      

      Compliant Solution

      switch ($i) {
        case 1:
        case 3:
          doSomething();
          break;
        case 2:
          doSomethingDifferent();
          break;
        default:
          doTheRest();
      }
      
      if (($a >= 0 && $a < 10) || ($a >= 20 && $a < 50)) {
        doTheThing();
      else if ($a >= 10 && $a < 20) {
        doTheOtherThing();
      }
      else {
        doTheRest();
      }
      
      doOneMoreThing();
      
      b = 4;
      

      or

      switch ($i) {
        case 1:
          doSomething();
          break;
        case 2:
          doSomethingDifferent();
          break;
        case 3:
          doThirdThing();
          break;
        default:
          doTheRest();
      }
      
      if ($a >= 0 && $a < 10) {
        doTheThing();
      else if ($a >= 10 && $a < 20) {
        doTheOtherThing();
      }
      else if ($a >= 20 && $a < 50) {
        doTheThirdThing();
      }
      else {
        doTheRest();
      }
      
      if ($b == 0) {
        doOneMoreThing();
      }
      else {
        doTheRest();
      }
      
      int b = a ? 12 > 4 : 8;
      

      Exceptions

      Blocks in an if chain that contain a single line of code are ignored, as are blocks in a switch statement that contain a single line of code with or without a following break.

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

           * @var string

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

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

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

                  $body = \App\Json::decode($response->getBody()->getContents());

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

                          'label' => $row['formatted_address'],

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

              } elseif (isset($body['error_message'])) {

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

           * Parse 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

                          if (false !== strpos($row['long_name'], '/')) {

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

                      case 'sublocality':

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

                          $address['addresslevel5'] = $row['long_name'];

      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

              } catch (\Throwable $exc) {

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

                  throw new \App\Exceptions\AppException("ERR_COMMUNICATION_ERROR|{$body['status']}: {$body['error_message']}");

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

           *

      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

                      case 'route':

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

                      case 'neighborhood':

      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

                          break;

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

           */

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

          protected static $url = 'https://maps.googleapis.com/maps/api/geocode/json?';

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

              $url = static::$url . "key={$key}&address=$value";

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

                  foreach ($body['results'] as $row) {

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

                          'countryCode' => strtolower($address['addresslevel1'][1] ?? ''),

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

          /**

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

                          'address' => $address,

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

                      case 'postal_code':

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

                      $rows[] = [

      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

                          'coordinates' => [

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

                  switch ($row['types'][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

                      case 'administrative_area_level_3':

      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

                          $address['addresslevel2'] = $row['long_name'];

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

          }

      Line exceeds 120 characters; contains 122 characters
      Open

                  throw new \App\Exceptions\AppException("ERR_COMMUNICATION_ERROR|{$body['status']}: {$body['error_message']}");

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

              return $rows;

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

              $address = [];

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

                              [$address['buildingnumber'], $address['localnumber']] = explode('/', $row['long_name'], 2);

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

          public $docUrl = 'https://code.google.com/apis/console/?noredirect';

      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

                      return 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

              foreach ($rows as $row) {

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

                          $address['addresslevel6'] = $row['long_name'];

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

                      case 'locality':

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

                      case 'country':

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

          public $customFields = [

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

                  'tooltip' => 'LBL_KEY_PLACEHOLDER',

      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

              $key = $this->config['key'];

      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

           * @param array $rows

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

                      case 'street_number':

      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

                      case 'administrative_area_level_2':

      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

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

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

                  \App\Log::warning('Error: ' . $url . ' | ' . $exc->getMessage(), __CLASS__);

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

                  \App\Log::warning("{$body['status']}: {$body['error_message']}", __NAMESPACE__);

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

                              $address['addresslevel7'] = $row['long_name'];

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

                          $address['addresslevel6'] = $row['long_name'];

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

                  'validator' => [['name' => 'AlphaNumeric']],

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

                  'label' => 'LBL_KEY',

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

                  'typeofdata' => 'V~M',

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

          public function find($value)

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

              $lang = \App\Language::getShortLanguageName();

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

                  return false;

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

                      $address = $this->parse($row['address_components']);

      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

                          break;

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

              return $address;

      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

                  'uitype' => 1,

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

                  'maximumlength' => '200',

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

                      \App\Log::warning('Error: ' . $url . ' | ' . $response->getStatusCode() . ' ' . $response->getReasonPhrase(), __CLASS__);

      Line exceeds 120 characters; contains 137 characters
      Open

                      \App\Log::warning('Error: ' . $url . ' | ' . $response->getStatusCode() . ' ' . $response->getReasonPhrase(), __CLASS__);

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

                          }

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

                          $address['addresslevel4'] = $row['long_name'];

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

                      case 'administrative_area_level_1':

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

                          $address['addresslevel1'] = $row['long_name'];

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

                      default:

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

          ];

      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

              }

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

                              'lat' => $row['geometry']['location']['lat'],

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

                              'lon' => $row['geometry']['location']['lng']

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

                          ],

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

                          $address['addresslevel3'] = $row['long_name'];

      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

                  }

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

           * API Address to retrieve data.

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

              }

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

                              $address['buildingnumber'] = $row['long_name'];

      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

                          break;

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

              }

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

                  'purifyType' => \App\Purifier::ALNUM,

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

              if (empty($value) || !\App\RequestUtil::isNetConnection()) {

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

                  if (200 !== $response->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

           * @return string[]

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

          private function parse($rows)

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

                          $address['addresslevel8'] = $row['long_name'];

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

                          if (empty($row['types'][1])) {

      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

              'key' => [

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

                  $response = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->get($url);

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

              $rows = [];

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

              if (empty($body['error_message']) && isset($body['status'])) {

      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

          {

      There are no issues that match your filters.

      Category
      Status