Passed
Push — master ( e7e3c4...d0e289 )
by Rogier
01:26
created

Directory   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
eloc 10
dl 0
loc 34
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A newAccount() 0 3 1
A all() 0 5 1
A newNonce() 0 3 1
A newOrder() 0 3 1
A getOrder() 0 5 1
A revoke() 0 3 1
1
<?php
2
3
namespace Rogierw\RwAcme\Endpoints;
4
5
class Directory extends Endpoint
6
{
7
    public function all()
8
    {
9
        return $this->client
10
            ->getHttpClient()
11
            ->get($this->client->getBaseUrl() . '/directory');
12
    }
13
14
    public function newNonce(): string
15
    {
16
        return $this->all()->getBody()['newNonce'];
17
    }
18
19
    public function newAccount(): string
20
    {
21
        return $this->all()->getBody()['newAccount'];
22
    }
23
24
    public function newOrder(): string
25
    {
26
        return $this->all()->getBody()['newOrder'];
27
    }
28
29
    public function getOrder(): string
30
    {
31
        $url = str_replace('new-order', 'order', $this->newOrder());
32
33
        return rtrim($url, '/') . '/';
34
    }
35
36
    public function revoke(): string
37
    {
38
        return $this->all()->getBody()['revokeCert'];
39
    }
40
}
41