| 1 | <?php |
||
| 7 | class Payload implements \JsonSerializable |
||
| 8 | { |
||
| 9 | const TITLE_LENGTH = 40; |
||
| 10 | const BODY_LENGTH = 90; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @var Notification |
||
| 14 | */ |
||
| 15 | private $notification; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Construct. |
||
| 19 | * |
||
| 20 | * @param Notification $notification |
||
| 21 | */ |
||
| 22 | 1 | public function __construct(Notification $notification) |
|
| 26 | |||
| 27 | /** |
||
| 28 | * Get the instance as an array. |
||
| 29 | * |
||
| 30 | * @return array |
||
| 31 | */ |
||
| 32 | 1 | public function toArray() |
|
| 46 | |||
| 47 | /** |
||
| 48 | * Specify data which should be serialized to JSON. |
||
| 49 | */ |
||
| 50 | 1 | public function jsonSerialize() |
|
| 54 | |||
| 55 | /** |
||
| 56 | * Limit string size. |
||
| 57 | * Realization: Laravel. |
||
| 58 | * |
||
| 59 | * @param string $value |
||
| 60 | * @param int $limit |
||
| 61 | * @param string $end |
||
| 62 | * @return string |
||
| 63 | */ |
||
| 64 | 1 | protected function limitString($value, $limit = 10, $end = '...') |
|
| 72 | } |
||
| 73 |