Passed
Push — master ( 4b5c0b...5361e0 )
by Damien
02:17
created

GoogleMaps::getRegion()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace DH\NavigationBundle\Provider\GoogleMaps;
4
5
use DH\NavigationBundle\Contract\DistanceMatrix\DistanceMatrixQueryInterface;
6
use DH\NavigationBundle\Provider\AbstractProvider;
7
use DH\NavigationBundle\Provider\GoogleMaps\DistanceMatrix\DistanceMatrixQuery;
8
use GuzzleHttp\ClientInterface;
9
10
class GoogleMaps extends AbstractProvider
11
{
12
    /**
13
     * @var string
14
     */
15
    private $api_key;
16
17
    /**
18
     * @var ?string
19
     */
20
    private $region;
21
22
    /**
23
     * Here constructor.
24
     *
25
     * @param ClientInterface $client
26
     * @param string          $apiKey an Api key
27
     * @param ?string         $region region
28
     */
29
    public function __construct(ClientInterface $client, string $apiKey, ?string $region = null)
0 ignored issues
show
Unused Code introduced by
The parameter $region is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

29
    public function __construct(ClientInterface $client, string $apiKey, /** @scrutinizer ignore-unused */ ?string $region = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
30
    {
31
        parent::__construct($client);
32
33
        $this->api_key = $apiKey;
34
    }
35
36
    /**
37
     * @return string
38
     */
39
    public function getName(): string
40
    {
41
        return 'google_maps';
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function getApiKey(): string
48
    {
49
        return $this->api_key;
50
    }
51
52
    /**
53
     * @return ?string
54
     */
55
    public function getRegion(): ?string
56
    {
57
        return $this->region;
58
    }
59
60
    /**
61
     * @return array
62
     */
63
    public function getCredentials(): array
64
    {
65
        return [
66
            'key' => $this->getApiKey(),
67
        ];
68
    }
69
70
    /**
71
     * @return DistanceMatrixQueryInterface
72
     */
73
    public function createDistanceMatrixQuery(): DistanceMatrixQueryInterface
74
    {
75
        return new DistanceMatrixQuery($this);
76
    }
77
78
    /**
79
     * @return string
80
     */
81
    public function __toString()
82
    {
83
        return $this->getName();
84
    }
85
}
86