Passed
Push — dev ( 0f4afd...29c427 )
by Janko
25:18 queued 14:48
created

UserSetting::getValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Orm\Entity;
6
7
use Doctrine\ORM\Mapping\Column;
8
use Doctrine\ORM\Mapping\Entity;
9
use Doctrine\ORM\Mapping\Id;
10
use Doctrine\ORM\Mapping\JoinColumn;
11
use Doctrine\ORM\Mapping\ManyToOne;
12
use Doctrine\ORM\Mapping\Table;
13
use Override;
0 ignored issues
show
Bug introduced by
The type Override was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use Stu\Module\PlayerSetting\Lib\UserSettingEnum;
15
use Stu\Orm\Repository\UserSettingRepository;
16
17
#[Table(name: 'stu_user_setting')]
18
#[Entity(repositoryClass: UserSettingRepository::class)]
19
class UserSetting implements UserSettingInterface
20
{
21
    #[Id]
22
    #[Column(type: 'integer')]
23
    private int $user_id;
24
25
    #[Id]
26
    #[Column(type: 'string', enumType: UserSettingEnum::class)]
27
    private UserSettingEnum $setting;
28
29
    #[Column(type: 'string')]
30
    private string $value = '';
31
32
    #[ManyToOne(targetEntity: 'User')]
33
    #[JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
34
    private UserInterface $user;
35
36
    #[Override]
37
    public function setUser(UserInterface $user): UserSettingInterface
38
    {
39
        $this->user = $user;
40
        $this->user_id = $user->getId();
41
42
        return $this;
43
    }
44
45
    #[Override]
46
    public function setSetting(UserSettingEnum $setting): UserSettingInterface
47
    {
48
        $this->setting = $setting;
49
50
        return $this;
51
    }
52
53 1
    #[Override]
54
    public function getValue(): string
55
    {
56 1
        return $this->value;
57
    }
58
59
    #[Override]
60
    public function setValue(string $value): UserSettingInterface
61
    {
62
        $this->value = $value;
63
64
        return $this;
65
    }
66
}
67