DistanceMatrix::distanceMatrix()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 10
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
namespace kalanis\google_maps\Services;
4
5
6
use Psr\Http\Message\RequestInterface;
7
8
9
/**
10
 * Directions Service
11
 *
12
 * @see     https://developers.google.com/maps/documentation/distance-matrix/
13
 * @see     https://developers.google.com/maps/documentation/distance-matrix/distance-matrix
14
 */
15
class DistanceMatrix extends AbstractService
16
{
17
    /**
18
     * Distance matrix
19
     *
20
     * @param string $origins
21
     * @param string $destinations
22
     * @param array<string, string|int|float> $params Query parameters
23
     * @return RequestInterface
24
     */
25 1
    public function distanceMatrix(string $origins, string $destinations, array $params = []): RequestInterface
26
    {
27
        // Parameters for Language setting
28 1
        $params['origins'] = $origins;
29 1
        $params['destinations'] = $destinations;
30
31 1
        return $this->getWithDefaults(
32 1
            static::API_HOST . '/maps/api/distancematrix/json',
33 1
            $this->queryParamsLang($params)
34 1
        );
35
    }
36
}
37