IdMutatorTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 24
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 8 2
A setId() 0 5 1
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