Passed
Push — master ( d0e289...84c60d )
by Rogier
02:10
created

Endpoint::getAccountPrivateKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Rogierw\RwAcme\Endpoints;
4
5
use Rogierw\RwAcme\Api;
6
use Rogierw\RwAcme\Support\KeyId;
7
8
abstract class Endpoint
9
{
10
    protected $client;
11
12
    public function __construct(Api $client)
13
    {
14
        $this->client = $client;
15
    }
16
17
    protected function createKeyId(string $acountUrl, string $url, $payload = null): array
18
    {
19
        return KeyId::generate(
20
            $payload,
21
            $acountUrl,
22
            $url,
23
            $this->client->nonce()->getNew(),
24
            $this->client->getAccountKeysPath()
25
        );
26
    }
27
28
    protected function getAccountPrivateKey(): string
29
    {
30
        return file_get_contents($this->client->getAccountKeysPath() . 'private.pem');
31
    }
32
}
33