| Total Complexity | 3 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class ContextDto implements \JsonSerializable |
||
| 10 | { |
||
| 11 | public $firstname; |
||
| 12 | public $lastname; |
||
| 13 | public $postalCode; |
||
| 14 | public $department; |
||
| 15 | public $characteristics; |
||
| 16 | public $characteristicsByType; |
||
| 17 | |||
| 18 | public function __construct(string $firstname, string $lastname, string $postalCode, array $characteristics = []) |
||
| 19 | { |
||
| 20 | $this->firstname = $firstname; |
||
| 21 | $this->lastname = $lastname; |
||
| 22 | $this->postalCode = $postalCode; |
||
| 23 | $this->department = (new PostalCode($postalCode))->department(); |
||
| 24 | $this->characteristics = $characteristics; |
||
| 25 | foreach($this->characteristics as $characteristic){ |
||
| 26 | $this->characteristicsByType[$characteristic->type()][] = $characteristic; |
||
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | public function jsonSerialize() |
||
| 39 | ]; |
||
| 40 | } |
||
| 42 |