| @@ 53-74 (lines=22) @@ | ||
| 50 | /** |
|
| 51 | * {@inheritdoc} |
|
| 52 | */ |
|
| 53 | public function getTemplate() |
|
| 54 | { |
|
| 55 | $actions = []; |
|
| 56 | ||
| 57 | foreach ($this->actions as $action) { |
|
| 58 | switch (strtolower($action->type)) { |
|
| 59 | case Action::TYPE_POSTBACK: |
|
| 60 | $actions[] = new PostbackTemplateActionBuilder($action->label, $action->value); |
|
| 61 | break; |
|
| 62 | case Action::TYPE_URI: |
|
| 63 | $actions[] = new UriTemplateActionBuilder($action->label, $action->value); |
|
| 64 | break; |
|
| 65 | default: |
|
| 66 | $actions[] = new MessageTemplateActionBuilder($action->label, $action->value);; |
|
| 67 | } |
|
| 68 | } |
|
| 69 | ||
| 70 | return new TemplateMessageBuilder( |
|
| 71 | $this->altText, |
|
| 72 | new ButtonTemplateBuilder($this->title, $this->text, $this->thumbnail, $actions) |
|
| 73 | ); |
|
| 74 | } |
|
| 75 | ||
| 76 | /** |
|
| 77 | * @param $label |
|
| @@ 43-66 (lines=24) @@ | ||
| 40 | /** |
|
| 41 | * {@inheritdoc} |
|
| 42 | */ |
|
| 43 | public function getTemplate() |
|
| 44 | { |
|
| 45 | $actions = []; |
|
| 46 | ksort($this->actions); |
|
| 47 | ||
| 48 | /** @var Action $action */ |
|
| 49 | foreach ($this->actions as $action) { |
|
| 50 | switch (strtolower($action->type)) { |
|
| 51 | case Action::TYPE_POSTBACK: |
|
| 52 | $actions[] = new PostbackTemplateActionBuilder($action->label, $action->value); |
|
| 53 | break; |
|
| 54 | case Action::TYPE_URI: |
|
| 55 | $actions[] = new UriTemplateActionBuilder($action->label, $action->value); |
|
| 56 | break; |
|
| 57 | default: |
|
| 58 | $actions[] = new MessageTemplateActionBuilder($action->label, $action->value);; |
|
| 59 | } |
|
| 60 | } |
|
| 61 | ||
| 62 | return new TemplateMessageBuilder( |
|
| 63 | $this->altText, |
|
| 64 | new ConfirmTemplateBuilder($this->title, $actions) |
|
| 65 | ); |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * @param string $label |
|