Completed
Push — master ( 535b5e...300324 )
by Jasper
13s queued 13s
created

AbstractRelation   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A dissociate() 0 5 1
A shouldOmitIncluded() 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|null
15
     */
16
    protected $included;
17
18
    /**
19
     * @var bool
20
     */
21
    protected $omitIncluded = false;
22
23
    /**
24
     * @return $this
25
     */
26 30
    public function dissociate()
27
    {
28 30
        $this->included = null;
29
30 30
        return $this;
31
    }
32
33
    /**
34
     * @param bool $omitIncluded
35
     *
36
     * @return $this
37
     */
38 10
    public function setOmitIncluded(bool $omitIncluded)
39
    {
40 10
        $this->omitIncluded = $omitIncluded;
41
42 10
        return $this;
43
    }
44
45
    /**
46
     * @return bool
47
     */
48 45
    public function shouldOmitIncluded(): bool
49
    {
50 45
        return $this->omitIncluded;
51
    }
52
}
53