Completed
Push — EZP-30969-fetch-reverse-relati... ( d71d24 )
by
unknown
121:16 queued 99:27
created

RelationListItem::hasRelation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
cc 1
nc 1
nop 0
rs 10
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
declare(strict_types=1);
8
9
namespace eZ\Publish\API\Repository\Values\Content\RelationList\Item;
10
11
use eZ\Publish\API\Repository\Values\Content\Relation;
12
use eZ\Publish\API\Repository\Values\Content\RelationList\RelationListItemInterface;
13
14
/**
15
 * Item of relation list.
16
 */
17
class RelationListItem implements RelationListItemInterface
18
{
19
    /**
20
     * @var \eZ\Publish\API\Repository\Values\Content\Relation
21
     */
22
    private $relation;
23
24
    public function __construct(Relation $relation)
25
    {
26
        $this->relation = $relation;
27
    }
28
29
    /**
30
     * @return \eZ\Publish\API\Repository\Values\Content\Relation|null
31
     */
32
    public function getRelation(): ?Relation
33
    {
34
        return $this->relation;
35
    }
36
37
    /**
38
     * @return bool
39
     */
40
    public function hasRelation(): bool
41
    {
42
        return $this->relation instanceof Relation;
43
    }
44
}
45