User   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
eloc 15
c 2
b 0
f 0
dl 0
loc 38
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setName() 0 3 1
A getName() 0 3 1
A getLogin() 0 3 1
A getRole() 0 3 1
A __construct() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace EcodevTests\Felix\Blog\Model;
6
7
use Doctrine\Common\Collections\Collection;
8
use Doctrine\ORM\Mapping as ORM;
9
use Ecodev\Felix\Acl\MultipleRoles;
10
use GraphQL\Doctrine\Attribute as API;
11
12
/**
13
 * A blog author.
14
 */
15
#[ORM\Entity]
16
final class User extends AbstractModel implements \Ecodev\Felix\Model\User
17
{
18
    #[ORM\Column(name: 'custom_column_name', type: 'string', length: 50, options: ['default' => ''])]
19
    private string $name = '';
20
21
    #[ORM\Column(type: 'string', length: 50, nullable: true)]
22
    private ?string $email = null;
0 ignored issues
show
introduced by
The private property $email is not used, and could be removed.
Loading history...
23
24
    #[ORM\Column(name: 'password', type: 'string', length: 255)]
25
    #[API\Exclude]
26
    private string $password;
0 ignored issues
show
introduced by
The private property $password is not used, and could be removed.
Loading history...
27
28
    #[ORM\OneToMany(targetEntity: 'EcodevTests\Felix\Blog\Model\Post', mappedBy: 'user')]
29
    private Collection $posts;
0 ignored issues
show
introduced by
The private property $posts is not used, and could be removed.
Loading history...
30
31
    public function __construct(private MultipleRoles|string $role = 'member')
32
    {
33
    }
34
35
    public function getName(): string
36
    {
37
        return $this->name;
38
    }
39
40
    public function setName(string $name): void
41
    {
42
        $this->name = $name;
43
    }
44
45
    public function getRole(): string|MultipleRoles
46
    {
47
        return $this->role;
48
    }
49
50
    public function getLogin(): ?string
51
    {
52
        return $this->name;
53
    }
54
}
55