Setting   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 37
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getKey() 0 2 1
A setKey() 0 3 1
A setValue() 0 3 1
A getValue() 0 2 1
1
<?php
2
3
namespace App\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
7
use Symfony\Component\Validator\Constraints as Assert;
8
9
#[ORM\Entity]
10
#[UniqueEntity(fields: ['key'])]
11
class Setting {
12
13
    #[ORM\Id]
14
    #[ORM\Column(name: 'key', type: 'string', unique: true)]
15
    #[Assert\NotBlank]
16
    private ?string $key = null;
17
18
    /**
19
     * @var mixed
20
     */
21
    #[ORM\Column(type: 'object')]
22
    private $value = null;
23
24
    public function getKey(): string {
25
        return $this->key;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->key could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
26
    }
27
28
    public function setKey(string $key): Setting {
29
        $this->key = $key;
30
        return $this;
31
    }
32
33
    /**
34
     * @return mixed
35
     */
36
    public function getValue() {
37
        return $this->value;
38
    }
39
40
    /**
41
     * @return Setting
42
     */
43
    public function setValue(mixed $value) {
44
        $this->value = $value;
45
        return $this;
46
    }
47
}