Passed
Push — master ( 6d8670...fc56ea )
by Damien
02:05
created

Here::getCredentials()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
3
namespace DH\NavigationBundle\Provider\Here;
4
5
use DH\NavigationBundle\Contract\DistanceMatrix\DistanceMatrixQueryInterface;
6
use DH\NavigationBundle\Provider\AbstractProvider;
7
use DH\NavigationBundle\Provider\Here\DistanceMatrix\DistanceMatrixQuery;
8
use GuzzleHttp\ClientInterface;
9
10
class Here extends AbstractProvider
11
{
12
    /**
13
     * @var string
14
     */
15
    private $app_id;
16
17
    /**
18
     * @var string
19
     */
20
    private $app_code;
21
22
    /**
23
     * @var bool
24
     */
25
    private $useCIT;
26
27
    /**
28
     * Here constructor.
29
     *
30
     * @param ClientInterface $client
31
     * @param string          $appId   an App ID
32
     * @param string          $appCode an App code
33
     * @param bool            $useCIT  use Customer Integration Testing environment (CIT) instead of production
34
     */
35
    public function __construct(ClientInterface $client, string $appId, string $appCode, bool $useCIT = false)
36
    {
37
        parent::__construct($client);
38
39
        $this->app_id = $appId;
40
        $this->app_code = $appCode;
41
        $this->useCIT = $useCIT;
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function getName(): string
48
    {
49
        return 'here';
50
    }
51
52
    /**
53
     * @return string
54
     */
55
    public function getAppId(): string
56
    {
57
        return $this->app_id;
58
    }
59
60
    /**
61
     * @return string
62
     */
63
    public function getAppCode(): string
64
    {
65
        return $this->app_code;
66
    }
67
68
    /**
69
     * @return bool
70
     */
71
    public function isCitEnabled(): bool
72
    {
73
        return $this->useCIT;
74
    }
75
76
    /**
77
     * @return array
78
     */
79
    public function getCredentials(): array
80
    {
81
        return [
82
            'app_id' => $this->getAppId(),
83
            'app_code' => $this->getAppCode(),
84
        ];
85
    }
86
87
    /**
88
     * @return DistanceMatrixQueryInterface
89
     */
90
    public function createDistanceMatrixQuery(): DistanceMatrixQueryInterface
91
    {
92
        return new DistanceMatrixQuery($this);
93
    }
94
95
    /**
96
     * @return string
97
     */
98
    public function __toString()
99
    {
100
        return $this->getName();
101
    }
102
}
103