UuidTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 35
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A setId() 0 6 1
1
<?php
2
3
namespace Mero\Bundle\BaseBundle\Entity\Field;
4
5
use Doctrine\ORM\Mapping as ORM;
6
7
trait UuidTrait
8
{
9
    /**
10
     * @var string Primary key UUID
11
     *
12
     * @ORM\Id
13
     * @ORM\Column(type="string")
14
     * @ORM\GeneratedValue(strategy="UUID")
15
     */
16
    protected $id;
17
18
    /**
19
     * Return primary key UUID identifier.
20
     *
21
     * @return string Primary key UUID
22
     */
23
    public function getId()
24
    {
25
        return $this->id;
26
    }
27
28
    /**
29
     * Sets primary key UUID identifier.
30
     *
31
     * @param string $id Primary key UUID
32
     *
33
     * @return UuidTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type UuidTrait 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...
34
     */
35
    public function setId($id)
36
    {
37
        $this->id = $id;
38
39
        return $this;
40
    }
41
}
42