1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
declare(strict_types=1);
namespace Kreait\Firebase\RemoteConfig;
use GuzzleHttp\Psr7\Uri;
use Kreait\Firebase\Value\Email;
use Psr\Http\Message\UriInterface;
final class User
{
private ?string $name = null;
private ?Email $email = null;
private ?UriInterface $imageUri = null;
private function __construct()
{
}
/**
* @internal
*
* @param array<string, string> $data
*/
public static function fromArray(array $data): self
{
$new = new self();
$new->name = $data['name'] ?? null;
$new->email = ($data['email'] ?? null) ? new Email($data['email']) : null;
$new->imageUri = ($data['imageUrl'] ?? null) ? new Uri($data['imageUrl']) : null;
return $new;
}
public function name(): ?string
{
return $this->name;
}
public function email(): ?Email
{
return $this->email;
}
public function imageUri(): ?UriInterface
{
return $this->imageUri;
}
}