Total Complexity | 7 |
Total Lines | 73 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
10 | abstract class AbstractRelation |
||
11 | { |
||
12 | use HasLinks; |
||
13 | use HasMeta; |
||
14 | |||
15 | /** |
||
16 | * @var \Swis\JsonApi\Client\Interfaces\DataInterface|false|null |
||
17 | */ |
||
18 | protected $data = false; |
||
19 | |||
20 | /** |
||
21 | * @var \Swis\JsonApi\Client\Interfaces\DataInterface|false|null |
||
22 | */ |
||
23 | protected $included = false; |
||
24 | |||
25 | /** |
||
26 | * @var bool |
||
27 | */ |
||
28 | protected $omitIncluded = false; |
||
29 | |||
30 | /** |
||
31 | * @return bool |
||
32 | */ |
||
33 | 112 | public function hasData(): bool |
|
34 | { |
||
35 | 112 | return $this->data !== false; |
|
36 | } |
||
37 | |||
38 | /** |
||
39 | * @return bool |
||
40 | */ |
||
41 | 188 | public function hasIncluded(): bool |
|
42 | { |
||
43 | 188 | return $this->included !== false; |
|
44 | } |
||
45 | |||
46 | /** |
||
47 | * @return $this |
||
48 | */ |
||
49 | 192 | public function dissociate() |
|
50 | { |
||
51 | 192 | $this->data = null; |
|
52 | 192 | $this->included = null; |
|
53 | |||
54 | 192 | return $this; |
|
55 | } |
||
56 | |||
57 | /** |
||
58 | * @return bool |
||
59 | */ |
||
60 | 112 | public function hasAssociated(): bool |
|
61 | { |
||
62 | 112 | return $this->hasData() || $this->hasIncluded(); |
|
63 | } |
||
64 | |||
65 | /** |
||
66 | * @param bool $omitIncluded |
||
67 | * |
||
68 | * @return $this |
||
69 | */ |
||
70 | 12 | public function setOmitIncluded(bool $omitIncluded) |
|
71 | { |
||
72 | 12 | $this->omitIncluded = $omitIncluded; |
|
73 | |||
74 | 12 | return $this; |
|
75 | } |
||
76 | |||
77 | /** |
||
78 | * @return bool |
||
79 | */ |
||
80 | 48 | public function shouldOmitIncluded(): bool |
|
83 | } |
||
84 | } |
||
85 |