IdMutatorTrait::setId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://github.com/flipboxfactory/craft-ember/blob/master/LICENSE
6
 * @link       https://github.com/flipboxfactory/craft-ember/
7
 */
8
9
namespace flipbox\craft\ember\objects;
10
11
/**
12
 * @property int|null $id
13
 *
14
 * @author Flipbox Factory <[email protected]>
15
 * @since 2.0.0
16
 */
17
trait IdMutatorTrait
18
{
19
    /**
20
     * @return int|null
21
     */
22
    public function getId()
23
    {
24
        if (null === $this->id) {
25
            return null;
26
        }
27
28
        return (int)$this->id;
29
    }
30
31
    /**
32
     * @param $id
33
     * @return $this
34
     */
35
    public function setId(int $id = null)
36
    {
37
        $this->id = $id;
38
        return $this;
39
    }
40
}
41