Passed
Push — master ( 7ec869...8ef4a4 )
by Damien
01:57
created

GoogleMaps::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 5
rs 10
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
     * Here constructor.
19
     *
20
     * @param ClientInterface $client
21
     * @param string          $apiKey an Api key
22
     */
23
    public function __construct(ClientInterface $client, string $apiKey)
24
    {
25
        parent::__construct($client);
26
27
        $this->api_key = $apiKey;
28
    }
29
30
    /**
31
     * @return string
32
     */
33
    public function getName(): string
34
    {
35
        return 'google_maps';
36
    }
37
38
    /**
39
     * @return string
40
     */
41
    public function getApiKey(): string
42
    {
43
        return $this->api_key;
44
    }
45
46
    /**
47
     * @return array
48
     */
49
    public function getCredentials(): array
50
    {
51
        return [
52
            'key' => $this->getApiKey(),
53
        ];
54
    }
55
56
    /**
57
     * @return DistanceMatrixQueryInterface
58
     */
59
    public function createDistanceMatrixQuery(): DistanceMatrixQueryInterface
60
    {
61
        return new DistanceMatrixQuery($this);
62
    }
63
64
    /**
65
     * @return string
66
     */
67
    public function __toString()
68
    {
69
        return $this->getName();
70
    }
71
}
72