Completed
Pull Request — master (#52)
by Jasper
04:02
created

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