| Total Complexity | 7 |
| Total Lines | 59 |
| 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 | 112 | public function hasData(): bool |
|
| 31 | { |
||
| 32 | 112 | return $this->data !== false; |
|
| 33 | } |
||
| 34 | |||
| 35 | 188 | public function hasIncluded(): bool |
|
| 36 | { |
||
| 37 | 188 | return $this->included !== false; |
|
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @return $this |
||
| 42 | */ |
||
| 43 | 192 | public function dissociate() |
|
| 44 | { |
||
| 45 | 192 | $this->data = null; |
|
| 46 | 192 | $this->included = null; |
|
| 47 | |||
| 48 | 192 | return $this; |
|
| 49 | } |
||
| 50 | |||
| 51 | 112 | public function hasAssociated(): bool |
|
| 52 | { |
||
| 53 | 112 | return $this->hasData() || $this->hasIncluded(); |
|
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @return $this |
||
| 58 | */ |
||
| 59 | 12 | public function setOmitIncluded(bool $omitIncluded) |
|
| 60 | { |
||
| 61 | 12 | $this->omitIncluded = $omitIncluded; |
|
| 62 | |||
| 63 | 12 | return $this; |
|
| 64 | } |
||
| 65 | |||
| 66 | 48 | public function shouldOmitIncluded(): bool |
|
| 69 | } |
||
| 70 | } |
||
| 71 |