Completed
Pull Request — master (#14)
by Pavel
04:42
created

TestReference::getReferencePayload()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Bankiru\Api\Doctrine\Test\Entity;
4
5
class TestReference
6
{
7
    /** @var  int */
8
    private $id;
9
    /** @var  string */
10
    private $referencePayload;
11
    /** @var  TestEntity */
12
    private $owner;
13
14
    /**
15
     * @return int
16
     */
17
    public function getId()
18
    {
19
        return $this->id;
20
    }
21
22
    /**
23
     * @return TestEntity
24
     */
25
    public function getOwner()
26
    {
27
        return $this->owner;
28
    }
29
30
    /**
31
     * @param TestEntity $owner
32
     */
33
    public function setOwner(TestEntity $owner = null)
34
    {
35
        if ($this->owner) {
36
            $this->owner->getReferences()->removeElement($this);
37
        }
38
39
        $this->owner = $owner;
40
41
        if ($this->owner) {
42
            $this->owner->getReferences()->add($this);
43
        }
44
    }
45
46
    /**
47
     * @return string
48
     */
49
    public function getReferencePayload()
50
    {
51
        return $this->referencePayload;
52
    }
53
}
54