ClientCredentials::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 4
dl 0
loc 10
ccs 5
cts 5
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace IproSoftwareApi\DTOs;
4
5
class ClientCredentials
6
{
7
    /** @var string */
8
    public $apiHost;
9
10
    /** @var string */
11
    public $tokenEndpoint;
12
13
    /** @var string */
14
    public $clientId;
15
16
    /** @var string */
17
    public $clientSecret;
18
19
    /**
20
     * ClientCredentials constructor.
21
     *
22
     * @param string $apiHost
23
     * @param string $clientId
24
     * @param string $clientSecret
25
     * @param string $tokenEndpoint
26
     */
27 18
    public function __construct(
28
        string $apiHost,
29
        string $clientId,
30
        string $clientSecret,
31
        string $tokenEndpoint = '/oauth/2.0/token'
32
    ) {
33 18
        $this->apiHost       = $apiHost;
34 18
        $this->clientId      = $clientId;
35 18
        $this->clientSecret  = $clientSecret;
36 18
        $this->tokenEndpoint = $tokenEndpoint;
37
    }
38
39 9
    public function valid()
40
    {
41 9
        return strlen($this->apiHost) && strlen($this->clientId) && strlen($this->clientSecret);
42
    }
43
}
44