1 | <?php |
||
21 | abstract class AbstractDevice |
||
22 | { |
||
23 | /** |
||
24 | * The input text. |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $text; |
||
29 | |||
30 | /** |
||
31 | * The dictionary instance. |
||
32 | * |
||
33 | * @var DictionaryInterface |
||
34 | */ |
||
35 | protected $dict; |
||
36 | |||
37 | /** |
||
38 | * The shorthand dict name. |
||
39 | * |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $shorthand = 'shorthand'; |
||
43 | |||
44 | /** |
||
45 | * Unique device Identifier. |
||
46 | * |
||
47 | * @var string |
||
48 | */ |
||
49 | protected $deviceIdentifier; |
||
50 | |||
51 | /** |
||
52 | * AbstractUnicode construct. |
||
53 | * |
||
54 | * @param string $text |
||
55 | */ |
||
56 | 15 | public function __construct($text = null) |
|
60 | |||
61 | /** |
||
62 | * @return string |
||
63 | */ |
||
64 | 1 | public function __toString() |
|
68 | |||
69 | /** |
||
70 | * Set the text. |
||
71 | * |
||
72 | * @param string $text |
||
73 | */ |
||
74 | 2 | public function setText($text) |
|
80 | |||
81 | /** |
||
82 | * Set the text. |
||
83 | * |
||
84 | * @param string $text |
||
85 | */ |
||
86 | 2 | public function withText($text) |
|
92 | |||
93 | /** |
||
94 | * Set the dictionary. |
||
95 | */ |
||
96 | 11 | public function setDictionary(DictionaryInterface $dict) |
|
102 | |||
103 | /** |
||
104 | * Returns the dictionary. |
||
105 | * |
||
106 | * @return DictionaryInterface |
||
107 | */ |
||
108 | 13 | public function getDictionary() |
|
117 | |||
118 | /** |
||
119 | * Output emoji. |
||
120 | * |
||
121 | * @return string |
||
122 | */ |
||
123 | 1 | public function emoji() |
|
127 | |||
128 | /** |
||
129 | * Returns shorthand of the text. |
||
130 | * |
||
131 | * @return string |
||
132 | */ |
||
133 | 2 | public function shorthand() |
|
141 | |||
142 | /** |
||
143 | * Returns codepoint of the unicode. |
||
144 | * |
||
145 | * @return string |
||
146 | */ |
||
147 | 1 | public function codepoint() |
|
155 | |||
156 | /** |
||
157 | * Converts to HTML. |
||
158 | * |
||
159 | * @return string |
||
160 | */ |
||
161 | 1 | public function html() |
|
168 | |||
169 | /** |
||
170 | * Converts to HTML entities. |
||
171 | * |
||
172 | * @return string |
||
173 | */ |
||
174 | 1 | public function htmlEntity() |
|
184 | |||
185 | /** |
||
186 | * Converts to target device. |
||
187 | * |
||
188 | * @param string $device |
||
189 | * |
||
190 | * @throws InvalidArgumentException |
||
191 | * |
||
192 | * @return mixed |
||
193 | */ |
||
194 | 6 | protected function deviceExchange($device) |
|
209 | |||
210 | /** |
||
211 | * Converts text. |
||
212 | * |
||
213 | * @param string $text |
||
214 | * @param mixed $search |
||
215 | * @param mixed $replace |
||
216 | * |
||
217 | * @return string |
||
218 | */ |
||
219 | 9 | protected function convert($text, $search, $replace) |
|
223 | |||
224 | /** |
||
225 | * Returns the device Identifier. |
||
226 | * |
||
227 | * @return string |
||
228 | */ |
||
229 | 11 | protected function getDeviceIdentifier() |
|
233 | |||
234 | /** |
||
235 | * Get the unicode dictionart dict. |
||
236 | * |
||
237 | * @return array |
||
238 | */ |
||
239 | 8 | protected function getUnicodeDict() |
|
245 | } |
||
246 |