ClientCredentials   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 37
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A valid() 0 3 3
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