| Total Complexity | 5 |
| Total Lines | 71 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class Message implements MessageContract |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Plain text message. |
||
| 11 | * |
||
| 12 | * @param string |
||
| 13 | */ |
||
| 14 | protected string $message; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Template options. |
||
| 18 | * |
||
| 19 | * @var array |
||
| 20 | */ |
||
| 21 | protected array $template = [ |
||
| 22 | 'identifier' => null, |
||
| 23 | 'params' => null, |
||
| 24 | ]; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Message constructor. |
||
| 28 | * |
||
| 29 | * @param string $message |
||
| 30 | */ |
||
| 31 | public function __construct(string $message) |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Retrieve string format of message. |
||
| 38 | * |
||
| 39 | * @return string |
||
| 40 | */ |
||
| 41 | public function toString(): string |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Retrieve string format of message. |
||
| 48 | * |
||
| 49 | * @param string $templateIdentifier |
||
| 50 | * @param array $params |
||
| 51 | * |
||
| 52 | * @return self |
||
| 53 | */ |
||
| 54 | public function useTemplateIfSupports(string $templateIdentifier, array $params = []): self |
||
| 55 | { |
||
| 56 | $this->template['identifier'] = $templateIdentifier; |
||
| 57 | $this->template['params'] = $params; |
||
| 58 | |||
| 59 | return $this; |
||
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Determine if message uses a template. |
||
| 64 | */ |
||
| 65 | public function usesTemplate(): bool |
||
| 68 | } |
||
| 69 | |||
| 70 | /** |
||
| 71 | * Retrieve template options. |
||
| 72 | * |
||
| 73 | * @return array |
||
| 74 | */ |
||
| 75 | public function getTemplate(): array |
||
| 80 |