Completed
Pull Request — master (#45)
by Jasper
11:05 queued 08:33
created

AbstractOneRelation::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
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 70
    public function associate(ItemInterface $included)
19
    {
20 70
        $this->included = $included;
21
22 70
        return $this;
23
    }
24
25
    /**
26
     * @return \Swis\JsonApi\Client\Interfaces\ItemInterface|null
27
     */
28 70
    public function getIncluded()
29
    {
30 70
        return $this->included;
31
    }
32
33
    /**
34
     * @return bool
35
     */
36
    public function hasIncluded(): bool
37
    {
38
        return null !== $this->getIncluded();
39
    }
40
}
41