UserLanguage   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 104
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 10
eloc 21
c 2
b 0
f 1
dl 0
loc 104
rs 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 3 1
A __construct() 0 5 1
A __toString() 0 3 1
A setIdentifier() 0 5 1
A setId() 0 3 1
A toData() 0 6 1
A getName() 0 3 1
A setName() 0 5 1
A getIdentifier() 0 3 1
A toJSON() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Admin\Domain\Entities;
6
7
use AbterPhp\Framework\Domain\Entities\IStringerEntity;
8
9
class UserLanguage implements IStringerEntity
10
{
11
    protected string $id;
12
13
    protected string $identifier;
14
15
    protected string $name;
16
17
    /**
18
     * Page constructor.
19
     *
20
     * @param string $id
21
     * @param string $identifier
22
     * @param string $name
23
     */
24
    public function __construct(string $id, string $identifier, string $name)
25
    {
26
        $this->id         = $id;
27
        $this->identifier = $identifier;
28
        $this->name       = $name;
29
    }
30
31
    /**
32
     * @return string
33
     */
34
    public function getId()
35
    {
36
        return $this->id;
37
    }
38
39
    /**
40
     * @param string $id
41
     */
42
    public function setId($id)
43
    {
44
        $this->id = $id;
45
    }
46
47
    /**
48
     * @return string
49
     */
50
    public function getIdentifier(): string
51
    {
52
        return $this->identifier;
53
    }
54
55
    /**
56
     * @param string $identifier
57
     *
58
     * @return $this
59
     */
60
    public function setIdentifier(string $identifier): UserLanguage
61
    {
62
        $this->identifier = $identifier;
63
64
        return $this;
65
    }
66
67
    /**
68
     * @return string
69
     */
70
    public function getName(): string
71
    {
72
        return $this->name;
73
    }
74
75
    /**
76
     * @param string $name
77
     *
78
     * @return $this
79
     */
80
    public function setName(string $name): UserLanguage
81
    {
82
        $this->name = $name;
83
84
        return $this;
85
    }
86
87
    /**
88
     * @return string
89
     */
90
    public function __toString(): string
91
    {
92
        return $this->getIdentifier();
93
    }
94
95
    /**
96
     * @return array|null
97
     */
98
    public function toData(): ?array
99
    {
100
        return [
101
            "id"         => $this->getId(),
102
            "identifier" => $this->getIdentifier(),
103
            "name"       => $this->getName(),
104
        ];
105
    }
106
107
    /**
108
     * @return string
109
     */
110
    public function toJSON(): string
111
    {
112
        return json_encode($this->toData());
113
    }
114
}
115