YetiForceCompany/YetiForceCRM

View on GitHub
app/Map/Routing/YetiForce.php

Summary

Maintainability
C
1 day
Test Coverage
F
0%

Method calculate has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function calculate()
    {
        $product = \App\YetiForce\Register::getProduct('YetiForceMap');
        if (!\App\RequestUtil::isNetConnection() || ((empty($product['params']['login']) || empty($product['params']['pass'])) && empty($product['params']['token']))) {
            throw new \App\Exceptions\AppException('ERR_NO_INTERNET_CONNECTION');
Severity: Major
Found in app/Map/Routing/YetiForce.php - About 2 hrs to fix

    Function calculate has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        public function calculate()
        {
            $product = \App\YetiForce\Register::getProduct('YetiForceMap');
            if (!\App\RequestUtil::isNetConnection() || ((empty($product['params']['login']) || empty($product['params']['pass'])) && empty($product['params']['token']))) {
                throw new \App\Exceptions\AppException('ERR_NO_INTERNET_CONNECTION');
    Severity: Minor
    Found in app/Map/Routing/YetiForce.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

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

        public function calculate()
        {
            $product = \App\YetiForce\Register::getProduct('YetiForceMap');
            if (!\App\RequestUtil::isNetConnection() || ((empty($product['params']['login']) || empty($product['params']['pass'])) && empty($product['params']['token']))) {
                throw new \App\Exceptions\AppException('ERR_NO_INTERNET_CONNECTION');
    Severity: Minor
    Found in app/Map/Routing/YetiForce.php by phpmd

    NPathComplexity

    Since: 0.1

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

    Example

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

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

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

        public function calculate()
        {
            $product = \App\YetiForce\Register::getProduct('YetiForceMap');
            if (!\App\RequestUtil::isNetConnection() || ((empty($product['params']['login']) || empty($product['params']['pass'])) && empty($product['params']['token']))) {
                throw new \App\Exceptions\AppException('ERR_NO_INTERNET_CONNECTION');
    Severity: Minor
    Found in app/Map/Routing/YetiForce.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

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

        public function calculate()
    Severity: Critical
    Found in app/Map/Routing/YetiForce.php by sonar-php

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

    See

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

                throw new \App\Exceptions\AppException($error, 500);
    Severity: Minor
    Found in app/Map/Routing/YetiForce.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 '26', column '14').
    Open

                throw new \App\Exceptions\AppException('ERR_NO_INTERNET_CONNECTION');
    Severity: Minor
    Found in app/Map/Routing/YetiForce.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 '49', column '20').
    Open

            $response = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->post($url, $options);
    Severity: Minor
    Found in app/Map/Routing/YetiForce.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\Language' in method 'calculate'.
    Open

                    'locale' => \App\Language::getShortLanguageName(),
    Severity: Minor
    Found in app/Map/Routing/YetiForce.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 'calculate'.
    Open

                $json = \App\Json::decode($response->getBody());
    Severity: Minor
    Found in app/Map/Routing/YetiForce.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 'calculate'.
    Open

            \App\Log::endProfile("POST|YetiForceRouting::calculate|{$url}", __NAMESPACE__);
    Severity: Minor
    Found in app/Map/Routing/YetiForce.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 calculate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $options['auth'] = [$product['params']['login'], $product['params']['pass']];
            }
    Severity: Minor
    Found in app/Map/Routing/YetiForce.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\Log' in method 'calculate'.
    Open

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

            } else {
                $error = 'Error with connection |' . $response->getReasonPhrase() . '|' . $response->getBody();
                $json = \App\Json::decode($response->getBody());
                if (400 === $response->getStatusCode() && isset($json['message'])) {
                    $error = $json['message'];
    Severity: Minor
    Found in app/Map/Routing/YetiForce.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\YetiForce\Register' in method 'calculate'.
    Open

            $product = \App\YetiForce\Register::getProduct('YetiForceMap');
    Severity: Minor
    Found in app/Map/Routing/YetiForce.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\YetiForce\Register' in method 'calculate'.
    Open

                    'InsKey' => \App\YetiForce\Register::getInstanceKey(),
    Severity: Minor
    Found in app/Map/Routing/YetiForce.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 'calculate'.
    Open

                $json = \App\Json::decode($response->getBody());
    Severity: Minor
    Found in app/Map/Routing/YetiForce.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 'calculate'.
    Open

            $response = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->post($url, $options);
    Severity: Minor
    Found in app/Map/Routing/YetiForce.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            if (!\App\RequestUtil::isNetConnection() || ((empty($product['params']['login']) || empty($product['params']['pass'])) && empty($product['params']['token']))) {
    Severity: Minor
    Found in app/Map/Routing/YetiForce.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 "distance" 3 times.
    Open

                    $this->distance += $path['distance'] / 1000;
    Severity: Critical
    Found in app/Map/Routing/YetiForce.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 "token" 3 times.
    Open

            if (!\App\RequestUtil::isNetConnection() || ((empty($product['params']['login']) || empty($product['params']['pass'])) && empty($product['params']['token']))) {
    Severity: Critical
    Found in app/Map/Routing/YetiForce.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 "params" 7 times.
    Open

            if (!\App\RequestUtil::isNetConnection() || ((empty($product['params']['login']) || empty($product['params']['pass'])) && empty($product['params']['token']))) {
    Severity: Critical
    Found in app/Map/Routing/YetiForce.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

    Call to method getInstanceKey from undeclared class \App\YetiForce\Register
    Open

                    'InsKey' => \App\YetiForce\Register::getInstanceKey(),
    Severity: Critical
    Found in app/Map/Routing/YetiForce.php by phan

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

            $response = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->post($url, $options);
    Severity: Critical
    Found in app/Map/Routing/YetiForce.php by phan

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

            $response = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->post($url, $options);
    Severity: Critical
    Found in app/Map/Routing/YetiForce.php by phan

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

            \App\Log::endProfile("POST|YetiForceRouting::calculate|{$url}", __NAMESPACE__);
    Severity: Critical
    Found in app/Map/Routing/YetiForce.php by phan

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

            \App\Log::beginProfile("POST|YetiForceRouting::calculate|{$url}", __NAMESPACE__);
    Severity: Critical
    Found in app/Map/Routing/YetiForce.php by phan

    Call to method getProduct from undeclared class \App\YetiForce\Register
    Open

            $product = \App\YetiForce\Register::getProduct('YetiForceMap');
    Severity: Critical
    Found in app/Map/Routing/YetiForce.php by phan

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            if (!empty($json['paths'])) {
                foreach ($json['paths'] as $path) {
                    $coordinates = array_merge($coordinates, $path['points']['coordinates']);
                    $this->distance += $path['distance'] / 1000;
                    $this->travelTime += $path['time'] / 1000;
    Severity: Major
    Found in app/Map/Routing/YetiForce.php and 1 other location - About 2 hrs to fix
    app/Map/Routing/GraphHopper.php on lines 48..57

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 135.

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

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

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

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

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        public function parsePoints(): array
        {
            $tracks = [
                [$this->start['lon'], $this->start['lat']],
            ];
    Severity: Major
    Found in app/Map/Routing/YetiForce.php and 1 other location - About 1 hr to fix
    app/Map/Routing/GraphHopper.php on lines 66..78

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 108.

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

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

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

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

    Refactorings

    Further Reading

    Line exceeds 120 characters; contains 168 characters
    Open

            if (!\App\RequestUtil::isNetConnection() || ((empty($product['params']['login']) || empty($product['params']['pass'])) && empty($product['params']['token']))) {

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

            $options = [

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

                    'InsKey' => \App\YetiForce\Register::getInstanceKey(),

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

                    'points' => $this->parsePoints(),

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

            }

    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

            $product = \App\YetiForce\Register::getProduct('YetiForceMap');

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

                $error = 'Error with connection |' . $response->getReasonPhrase() . '|' . $response->getBody();

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

            }

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

                        $description .= $instruction['text'] . ($instruction['distance'] ? ' (' . (int) $instruction['distance'] . 'm)' : '') . '<br>';

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

                'type' => 'LineString',

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

                    $tracks[] = [$tempLon['lon'], $tempLon['lat']];

    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['auth'] = [$product['params']['login'], $product['params']['pass']];

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

            $this->geoJson = [

    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 parsePoints(): 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

                    $error = $json['message'];

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

                [$this->start['lon'], $this->start['lat']],

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

                foreach ($this->indirectPoints as $tempLon) {

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

                'timeout' => 120,

    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

            $coordinates = [];

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

            if (!empty($json['paths'])) {

    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->indirectPoints)) {

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

                throw new \App\Exceptions\AppException('ERR_NO_INTERNET_CONNECTION');

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

                'version' => 2.0,

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

                'json' => array_merge([

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

                    'points_encoded' => 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

                if (400 === $response->getStatusCode() && isset($json['message'])) {

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

            $params = [];

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

            $url = 'https://osm-route.yetiforce.eu?' . http_build_query($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

            $tracks = [

    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($product['params']['token'])) {

    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' => $coordinates,

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

            $this->description = $description;

    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

            \App\Log::endProfile("POST|YetiForceRouting::calculate|{$url}", __NAMESPACE__);

    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

                    $coordinates = array_merge($coordinates, $path['points']['coordinates']);

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

                    }

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

            $tracks[] = [$this->end['lon'], $this->end['lat']];

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

                $params['yf_token'] = $product['params']['token'];

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

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

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

                throw new \App\Exceptions\AppException($error, 500);

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

                    foreach ($path['instructions'] as $instruction) {

    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 (!\App\RequestUtil::isNetConnection() || ((empty($product['params']['login']) || empty($product['params']['pass'])) && empty($product['params']['token']))) {

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

            \App\Log::beginProfile("POST|YetiForceRouting::calculate|{$url}", __NAMESPACE__);

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

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

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

            $description = '';

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

                    $this->distance += $path['distance'] / 1000;

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

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

                ], $this->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

                    'locale' => \App\Language::getShortLanguageName(),

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

                foreach ($json['paths'] as $path) {

    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 calculate()

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

                'http_errors' => false,

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

                'headers' => [

    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

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

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

                    $this->travelTime += $path['time'] / 1000;

    Line exceeds 120 characters; contains 147 characters
    Open

                        $description .= $instruction['text'] . ($instruction['distance'] ? ' (' . (int) $instruction['distance'] . 'm)' : '') . '<br>';

    There are no issues that match your filters.

    Category
    Status