| Conditions | 3 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 39 | public function getTemplate() |
||
| 40 | { |
||
| 41 | $text = $this->text; |
||
| 42 | |||
| 43 | if ($this->emoticon) { |
||
| 44 | $emoticon = substr($this->emoticon, 2); |
||
| 45 | |||
| 46 | if (!$emoticon = @hex2bin(str_repeat('0', 8 - strlen($emoticon)).$emoticon)) { |
||
| 47 | throw new \RuntimeException('hex2bin(): Input string must be hexadecimal string. see - https://devdocs.line.me/files/emoticon.pdf'); |
||
| 48 | } |
||
| 49 | |||
| 50 | $emoticon = mb_convert_encoding($emoticon, 'UTF-8', 'UTF-32BE'); |
||
| 51 | |||
| 52 | $text = sprintf("%s %s", $emoticon, $this->text); |
||
| 53 | } |
||
| 54 | |||
| 55 | return new TextMessageBuilder($text, ...$this->extra); |
||
| 56 | } |
||
| 58 |