1 | <?php |
||
21 | class DeviceEntity implements \JsonSerializable |
||
22 | { |
||
23 | const PLATFORM_ANDROID = 'android'; |
||
24 | const PLATFORM_IOS = 'ios'; |
||
25 | |||
26 | const ANDROID_TOKEN_PATTERN = '/^[0-9a-zA-Z-_.]+$/'; |
||
27 | const IOS_TOKEN_PATTERN = '/^[\da-f]{64}$/'; |
||
28 | |||
29 | /** |
||
30 | * @ORM\Id |
||
31 | * @ORM\Column(type="uuid") |
||
32 | * @ORM\GeneratedValue(strategy="CUSTOM") |
||
33 | * @ORM\CustomIdGenerator(class="Ramsey\Uuid\Doctrine\UuidGenerator") |
||
34 | * |
||
35 | * @var \Ramsey\Uuid\Uuid |
||
36 | */ |
||
37 | protected $uuid; |
||
38 | |||
39 | /** |
||
40 | * @ORM\Column(type="string", unique=true, length=255) |
||
41 | * |
||
42 | * @var string |
||
43 | */ |
||
44 | private $token; |
||
45 | |||
46 | /** |
||
47 | * @ORM\Column(type="string", length=10) |
||
48 | * |
||
49 | * @var string |
||
50 | */ |
||
51 | private $platform; |
||
52 | |||
53 | /** |
||
54 | * @return \Ramsey\Uuid\Uuid |
||
55 | */ |
||
56 | public function getUuid() |
||
60 | |||
61 | /** |
||
62 | * @param Uuid $uuid |
||
63 | * |
||
64 | * @return $this |
||
65 | */ |
||
66 | public function setUuid(Uuid $uuid) |
||
72 | |||
73 | /** |
||
74 | * @return string |
||
75 | */ |
||
76 | public function getToken() |
||
80 | |||
81 | /** |
||
82 | * @param string $token |
||
83 | * |
||
84 | * @throws \InvalidArgumentException |
||
85 | * |
||
86 | * @return $this |
||
87 | */ |
||
88 | public function setToken($token) |
||
100 | |||
101 | /** |
||
102 | * @return string |
||
103 | */ |
||
104 | public function getPlatform() |
||
108 | |||
109 | /** |
||
110 | * @param string $platform |
||
111 | * |
||
112 | * @throws \InvalidArgumentException |
||
113 | * |
||
114 | * @return $this |
||
115 | */ |
||
116 | public function setPlatform($platform) |
||
129 | |||
130 | /** |
||
131 | * {@inheritdoc} |
||
132 | */ |
||
133 | public function jsonSerialize() |
||
141 | } |
||
142 |