Passed
Push — master ( 0676a7...01ab94 )
by Artem
11:54
created

TrustedDeviceRepository::getSupportedFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 9
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
// ---------------------------------------------------------------------
4
//
5
//  Copyright (C) 2018-2024 Artem Rodygin
6
//
7
//  You should have received a copy of the MIT License along with
8
//  this file. If not, see <https://opensource.org/licenses/MIT>.
9
//
10
// ---------------------------------------------------------------------
11
12
namespace Linode\Profile\Repository;
13
14
use Linode\Entity;
15
use Linode\Internal\AbstractRepository;
16
use Linode\Profile\TrustedDevice;
17
use Linode\Profile\TrustedDeviceRepositoryInterface;
18
19
/**
20
 * @codeCoverageIgnore This class was autogenerated.
21
 */
22
class TrustedDeviceRepository extends AbstractRepository implements TrustedDeviceRepositoryInterface
23
{
24
    public function revokeTrustedDevice(int $deviceId): void
25
    {
26
        $this->client->delete(sprintf('%s/%s', $this->getBaseUri(), $deviceId));
27
    }
28
29
    protected function getBaseUri(): string
30
    {
31
        return '/profile/devices';
32
    }
33
34
    protected function getSupportedFields(): array
35
    {
36
        return [
37
            TrustedDevice::FIELD_ID,
38
            TrustedDevice::FIELD_CREATED,
39
            TrustedDevice::FIELD_EXPIRY,
40
            TrustedDevice::FIELD_USER_AGENT,
41
            TrustedDevice::FIELD_LAST_AUTHENTICATED,
42
            TrustedDevice::FIELD_LAST_REMOTE_ADDR,
43
        ];
44
    }
45
46
    protected function jsonToEntity(array $json): Entity
47
    {
48
        return new TrustedDevice($this->client, $json);
49
    }
50
}
51