Passed
Push — master ( 32a2e1...73c03e )
by Derek Stephen
07:43
created

Resource::getObject()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 0
cp 0
crap 2
rs 10
c 0
b 0
f 0
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 1
    public function __construct(
12
        private readonly object $object,
13
        private readonly string $idMethod = 'getId'
14 1
    ) {}
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
    public function getObject(): object
27
    {
28
        return $this->object;
29
    }
30
}
31