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

GoogleMaps   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 60
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A createDistanceMatrixQuery() 0 3 1
A getApiKey() 0 3 1
A __toString() 0 3 1
A getCredentials() 0 4 1
A __construct() 0 5 1
A getName() 0 3 1
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