Failed Conditions
Branch master (69f595)
by Gawain
07:16
created

Relations::actAsInverse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 1
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace Bolt\Storage\Entity;
3
4
/**
5
 * Entity for Auth Tokens.
6
 */
7
class Relations extends Entity
8
{
9
    protected $id;
10
    protected $from_contenttype;
11
    protected $from_id;
12
    protected $to_contenttype;
13
    protected $to_id;
14
15
    private $invert = false;
16
17
    public function actAsInverse()
18
    {
19
        $this->invert = true;
20
    }
21
22
    public function getToId()
23
    {
24
        if ($this->invert === true) {
25
            return $this->from_id;
26
        }
27
28
        return $this->to_id;
29
    }
30
31
    public function isInverted()
32
    {
33
        return $this->invert;
34
    }
35
}
36