Resource::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Del\Passport;
6
7
use function get_class;
8
9
class Resource implements ResourceInterface
10
{
11 2
    public function __construct(
12
        private readonly object $object,
13
        private readonly string $idMethod = 'getId'
14 2
    ) {}
15
16 1
    public function getResourceType(): string
17
    {
18 1
        return get_class($this->object);
19
    }
20
21 1
    public function getResourceId(): int
22
    {
23 1
        return $this->object->{$this->idMethod}();
24
    }
25
26 1
    public function getObject(): object
27
    {
28 1
        return $this->object;
29
    }
30
}
31