Total Complexity | 4 |
Total Lines | 61 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
21 | class TemplateMessage extends Message implements TemplateMessageInterface |
||
22 | { |
||
23 | /** |
||
24 | * the immutable name or slug of a template that exists in the user's account. |
||
25 | * For backwards-compatibility, the template name may also be used but the immutable slug is preferred. |
||
26 | * |
||
27 | * @var string $name |
||
28 | */ |
||
29 | protected $name; |
||
30 | |||
31 | /** |
||
32 | * an array of template content to send. |
||
33 | * Each item in the array should be a struct with two keys |
||
34 | * - name: the name of the content block to set the content for |
||
35 | * - content: the actual content to put into the block |
||
36 | * |
||
37 | * @var array $content |
||
38 | */ |
||
39 | protected $content = []; |
||
40 | |||
41 | public function __construct(string $name) |
||
42 | { |
||
43 | $this->name = $name; |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * the immutable name or slug of a template that exists in the user's account. |
||
48 | * |
||
49 | * @return string |
||
50 | */ |
||
51 | public function getName(): string |
||
52 | { |
||
53 | return $this->name; |
||
54 | } |
||
55 | |||
56 | |||
57 | /** |
||
58 | * @param string $name the name of the mc:edit editable region to inject into |
||
59 | * @param string $content the content to inject |
||
60 | */ |
||
61 | public function addContent(string $name, string $content) |
||
66 | ]; |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * an array of template content to send. |
||
71 | * |
||
72 | * [[ |
||
73 | * 'name' => 'template_constant', |
||
74 | * 'content' => 'template content' |
||
75 | * ]] |
||
76 | * |
||
77 | * @return array |
||
78 | */ |
||
79 | public function getContent(): array |
||
82 | } |
||
83 | } |
||
84 |