Total Complexity | 5 |
Total Lines | 54 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | final class PrimaryKeyReference |
||
13 | { |
||
14 | /** |
||
15 | * @var ApiResourceClassMetadata |
||
16 | */ |
||
17 | private $metadata; |
||
18 | |||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | private $identifierValue; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | private $resourceUrl; |
||
28 | |||
29 | /** |
||
30 | * @param ApiResourceClassMetadata $metadata |
||
31 | * @param string|int|float|bool|object $identifierValue |
||
32 | */ |
||
33 | public function __construct(ApiResourceClassMetadata $metadata, string $resourceUrl, $identifierValue) |
||
34 | { |
||
35 | $this->metadata = $metadata; |
||
36 | $this->resourceUrl = $resourceUrl; |
||
37 | if ($identifierValue instanceof ValueObjectInterface) { |
||
38 | $this->identifierValue = (string) $identifierValue->toNative(); |
||
39 | } else { |
||
40 | $this->identifierValue = (string) $identifierValue; |
||
41 | } |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * @return ApiResourceClassMetadata |
||
46 | */ |
||
47 | public function getMetadata(): ApiResourceClassMetadata |
||
48 | { |
||
49 | return $this->metadata; |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * @return string |
||
54 | */ |
||
55 | public function getUrl(): string |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @return string |
||
62 | */ |
||
63 | public function getIdentifierValue(): string |
||
66 | } |
||
67 | } |
||
68 |