ClientCredentials::valid()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 1
nc 3
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 3
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