User::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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