Completed
Branch master (cf27fb)
by Vladimir
02:33
created

AuthenticatedClient::getApiToken()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace allejo\DaPulse\Tests\Utilities;
4
5
class AuthenticatedClient
6
{
7
    private $apiToken;
8
9
    public function __construct ($filePath)
10
    {
11
        if (file_exists($filePath))
12
        {
13
            $file = file_get_contents($filePath, true);
14
            $json = json_decode($file, true);
15
            $this->apiToken = $json['apiToken'];
16
        }
17
        else if (getenv('apiToken') !== false)
18
        {
19
            $this->apiToken = getenv('apiToken');
20
        }
21
    }
22
23
    public function isAuthenticationSetup ()
24
    {
25
        return (isset($this->apiToken));
26
    }
27
28
    public function getApiToken()
29
    {
30
        return $this->apiToken;
31
    }
32
}
33