Passed
Push — master ( b7c92b...6155c6 )
by Derek Stephen
12:55
created

Resource   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 15
ccs 6
cts 6
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getResourceId() 0 3 1
A getResourceType() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Del\Passport;
6
7
class Resource implements ResourceInterface
8
{
9 1
    public function __construct(
10
        private readonly mixed $object,
11
        private readonly string $idMethod = 'getId'
12 1
    ) {}
13
14 1
    public function getResourceType(): string
15
    {
16 1
        return \get_class($this->object);
17
    }
18
19 1
    public function getResourceId(): int
20
    {
21 1
        return $this->object->{$this->idMethod}();
22
    }
23
}
24