ApiConfiguration::getApiKey()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
crap 6
1
<?php namespace GameScan\WoW;
2
3
use GameScan\Core\Request\Api\ApiConfigurationInterface;
4
use GameScan\Core\Tools\Environment;
5
6
class ApiConfiguration implements ApiConfigurationInterface
7
{
8
    private $apiKey = null;
9
10
    /**
11
     * Get parameters mandatory for request an api
12
     * @return array
13
     */
14
    public function getParameters()
15
    {
16
        return [
17
            "apikey" => $this->getApiKey()
18
        ];
19
    }
20
21
    /**
22
     * Get headers mandatory for request an api
23
     * @return array
24
     */
25
    public function getHeaders()
26
    {
27
        return array();
28
    }
29
30
    private function getApiKey()
31
    {
32
        if ($this->apiKey === null) {
33
            $this->apiKey = (new Environment())->get("WOW_API_KEY");
34
        }
35
        return $this->apiKey;
36
    }
37
}
38