Total Complexity | 14 |
Total Lines | 100 |
Duplicated Lines | 0 % |
Coverage | 65% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
18 | class Customer implements CustomerInterface |
||
19 | { |
||
20 | /** |
||
21 | * @var integer |
||
22 | */ |
||
23 | protected $id; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $login; |
||
29 | |||
30 | /** |
||
31 | * @var CustomerInterface |
||
32 | */ |
||
33 | protected $seller; |
||
34 | |||
35 | /** |
||
36 | * @var Customer[] |
||
37 | */ |
||
38 | protected $sellers = []; |
||
39 | |||
40 | 40 | protected ?CustomerState $state = null; |
|
41 | |||
42 | 40 | public function __construct($id, $login, CustomerInterface $seller = null, ?CustomerState $state = null) |
|
43 | 40 | { |
|
44 | 40 | $this->id = $id; |
|
45 | 40 | $this->login = $login; |
|
46 | $this->seller = $seller; |
||
47 | 1 | $this->state = $state; |
|
48 | } |
||
49 | 1 | ||
50 | public function getId() |
||
51 | { |
||
52 | return $this->id; |
||
53 | } |
||
54 | |||
55 | 1 | /** |
|
56 | * {@inheritdoc} |
||
57 | 1 | */ |
|
58 | public function getUniqueId() |
||
59 | { |
||
60 | return $this->getId() ?: $this->getLogin(); |
||
61 | } |
||
62 | |||
63 | 6 | /** |
|
64 | * {@inheritdoc} |
||
65 | 6 | */ |
|
66 | public function getLogin() |
||
69 | } |
||
70 | |||
71 | 5 | /** |
|
72 | * {@inheritdoc} |
||
73 | 5 | */ |
|
74 | public function getSeller() |
||
75 | { |
||
76 | return $this->seller; |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * {@inheritdoc} |
||
81 | */ |
||
82 | public function getState(): ?CustomerState |
||
85 | } |
||
86 | |||
87 | public function setState(CustomerState $state): self |
||
92 | } |
||
93 | |||
94 | public function isDeleted(): bool |
||
95 | { |
||
96 | return CustomerState::isDeleted($this); |
||
97 | } |
||
98 | |||
99 | public static function fromArray(array $info) |
||
112 | ); |
||
113 | } |
||
114 | |||
115 | public function jsonSerialize(): array |
||
120 |