Total Complexity | 7 |
Total Lines | 80 |
Duplicated Lines | 0 % |
Coverage | 80% |
Changes | 0 |
1 | <?php |
||
8 | abstract class AbstractOneRelation extends AbstractRelation |
||
9 | { |
||
10 | /** |
||
11 | * @var \Swis\JsonApi\Client\Interfaces\ItemInterface|null |
||
12 | */ |
||
13 | protected $included; |
||
14 | |||
15 | /** |
||
16 | * @var int |
||
17 | */ |
||
18 | protected $id; |
||
19 | |||
20 | /** |
||
21 | * @param \Swis\JsonApi\Client\Interfaces\DataInterface $included |
||
22 | * |
||
23 | * @throws \InvalidArgumentException |
||
24 | * |
||
25 | * @return $this |
||
26 | */ |
||
27 | 60 | public function associate(DataInterface $included) |
|
40 | } |
||
41 | |||
42 | /** |
||
43 | * @return $this |
||
44 | */ |
||
45 | 10 | public function dissociate() |
|
46 | { |
||
47 | 10 | $this->setId(null); |
|
48 | |||
49 | 10 | $this->included = null; |
|
50 | |||
51 | 10 | return $this; |
|
52 | } |
||
53 | |||
54 | /** |
||
55 | * @return mixed |
||
56 | */ |
||
57 | 25 | public function getId() |
|
58 | { |
||
59 | 25 | return $this->id; |
|
60 | } |
||
61 | |||
62 | /** |
||
63 | * @param mixed $id |
||
64 | * |
||
65 | * @return $this |
||
66 | */ |
||
67 | 75 | public function setId($id) |
|
68 | { |
||
69 | 75 | $this->id = $id; |
|
70 | |||
71 | 75 | return $this; |
|
72 | } |
||
73 | |||
74 | /** |
||
75 | * @return \Swis\JsonApi\Client\Interfaces\ItemInterface|null |
||
76 | */ |
||
77 | 60 | public function getIncluded() |
|
80 | } |
||
81 | |||
82 | /** |
||
83 | * @return bool |
||
84 | */ |
||
85 | public function hasIncluded(): bool |
||
88 | } |
||
89 | } |
||
90 |