Completed
Push — feature/fixing_cost ( ef981e )
by Laurent
01:53
created

Id   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 3 1
A getId() 0 4 1
1
<?php
2
3
4
namespace FlightLog\Domain\Common\ValueObject;
5
6
7
trait Id
8
{
9
    /**
10
     * @var int
11
     */
12
    private $id;
13
14
    /**
15
     * @param int $id
16
     */
17
    public function __construct($id)
18
    {
19
        $this->id = $id;
20
    }
21
22
    /**
23
     * @param int $id
24
     *
25
     * @return Id
0 ignored issues
show
Comprehensibility Bug introduced by
The return type Id is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
26
     */
27
    public static function create($id){
28
        return new self($id);
29
    }
30
31
    /**
32
     * @return int
33
     */
34
    public function getId()
35
    {
36
        return $this->id;
37
    }
38
39
}