Completed
Pull Request — master (#45)
by Jasper
11:58
created

AbstractOneRelation::dissociate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Swis\JsonApi\Client\Relations;
4
5
use Swis\JsonApi\Client\Interfaces\ItemInterface;
6
use Swis\JsonApi\Client\Interfaces\OneRelationInterface;
7
8
/**
9
 * @property \Swis\JsonApi\Client\Interfaces\ItemInterface|null $included
10
 */
11
abstract class AbstractOneRelation extends AbstractRelation implements OneRelationInterface
12
{
13
    /**
14
     * @param \Swis\JsonApi\Client\Interfaces\ItemInterface $included
15
     *
16
     * @return $this
17
     */
18
    public function associate(ItemInterface $included)
19
    {
20
        $this->included = $included;
21
22
        return $this;
23
    }
24
25
    /**
26
     * @return \Swis\JsonApi\Client\Interfaces\ItemInterface|null
27 75
     */
28
    public function getIncluded()
29 75
    {
30
        return $this->included;
31
    }
32
33
    /**
34
     * @return bool
35 75
     */
36
    public function hasIncluded(): bool
37 75
    {
38
        return null !== $this->getIncluded();
39 75
    }
40
}
41