Completed
Push — master ( a3b3fc...7ff218 )
by Jasper
18s queued 12s
created

AbstractRelation   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 1 Features 0
Metric Value
eloc 11
dl 0
loc 51
ccs 8
cts 8
cp 1
rs 10
c 3
b 1
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A dissociate() 0 5 1
A shouldOmitIncluded() 0 3 1
A hasIncluded() 0 3 1
A setOmitIncluded() 0 5 1
1
<?php
2
3
namespace Swis\JsonApi\Client\Relations;
4
5
use Swis\JsonApi\Client\Concerns\HasLinks;
6
use Swis\JsonApi\Client\Concerns\HasMeta;
7
8
abstract class AbstractRelation
9
{
10
    use HasLinks;
11
    use HasMeta;
12
13
    /**
14
     * @var \Swis\JsonApi\Client\Interfaces\DataInterface|false|null
15
     */
16
    protected $included = false;
17
18
    /**
19
     * @var bool
20
     */
21
    protected $omitIncluded = false;
22
23
    /**
24
     * @return $this
25
     */
26 99
    public function dissociate()
27
    {
28 99
        $this->included = null;
29
30 99
        return $this;
31
    }
32
33
    /**
34
     * @return bool
35
     */
36
    public function hasIncluded(): bool
37
    {
38 27
        return $this->included !== false;
39
    }
40 27
41
    /**
42 27
     * @param bool $omitIncluded
43
     *
44
     * @return $this
45
     */
46
    public function setOmitIncluded(bool $omitIncluded)
47
    {
48 108
        $this->omitIncluded = $omitIncluded;
49
50 108
        return $this;
51
    }
52
53
    /**
54
     * @return bool
55
     */
56
    public function shouldOmitIncluded(): bool
57
    {
58
        return $this->omitIncluded;
59
    }
60
}
61