Total Complexity | 4 |
Total Lines | 58 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
9 | class PersonaSettings implements \JsonSerializable |
||
10 | { |
||
11 | use ValidatorTrait; |
||
12 | |||
13 | /** |
||
14 | * @var string |
||
15 | */ |
||
16 | protected $name; |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $profilePictureUrl; |
||
22 | |||
23 | /** |
||
24 | * Persona constructor. |
||
25 | * |
||
26 | * @param string $name |
||
27 | * @param string $profilePictureUrl |
||
28 | */ |
||
29 | 1 | public function __construct(string $name, string $profilePictureUrl) |
|
35 | 1 | } |
|
36 | |||
37 | /** |
||
38 | * @param string $name |
||
39 | * @param string $profilePictureUrl |
||
40 | * |
||
41 | * @return \Kerox\Messenger\Model\PersonaSettings |
||
42 | */ |
||
43 | 1 | public static function create(string $name, string $profilePictureUrl): self |
|
46 | } |
||
47 | |||
48 | /** |
||
49 | * @return array |
||
50 | */ |
||
51 | 1 | public function toArray(): array |
|
52 | { |
||
53 | $array = [ |
||
54 | 1 | 'name' => $this->name, |
|
55 | 1 | 'profile_picture_url' => $this->profilePictureUrl, |
|
56 | ]; |
||
57 | |||
58 | 1 | return array_filter($array); |
|
59 | } |
||
60 | |||
61 | /** |
||
62 | * @return array |
||
63 | */ |
||
64 | 1 | public function jsonSerialize(): array |
|
67 | } |
||
68 | } |
||
69 |