Code Duplication    Length = 19-19 lines in 2 locations

src/Template/ActionTemplateTrait.php 1 location

@@ 30-48 (lines=19) @@
27
    /**
28
     * @return Action[]
29
     */
30
    private function createActions()
31
    {
32
        $actions = [];
33
34
        foreach ($this->actions as $action) {
35
            switch (strtolower($action->type)) {
36
                case Action::TYPE_POSTBACK:
37
                    $actions[] = new PostbackTemplateActionBuilder($action->label, $action->value);
38
                    break;
39
                case Action::TYPE_URI:
40
                    $actions[] = new UriTemplateActionBuilder($action->label, $action->value);
41
                    break;
42
                default:
43
                    $actions[] = new MessageTemplateActionBuilder($action->label, $action->value);
44
            }
45
        }
46
47
        return $actions;
48
    }
49
}
50

src/Template/Carousel/CarouselTemplate.php 1 location

@@ 44-62 (lines=19) @@
41
     *
42
     * @return Action[]
43
     */
44
    private function createItemActions(Item $item)
45
    {
46
        $actions = [];
47
48
        foreach ($item->actions as $action) {
49
            switch (strtolower($action->type)) {
50
                case Action::TYPE_POSTBACK:
51
                    $actions[] = new PostbackTemplateActionBuilder($action->label, $action->value);
52
                    break;
53
                case Action::TYPE_URI:
54
                    $actions[] =  new UriTemplateActionBuilder($action->label, $action->value);
55
                    break;
56
                default:
57
                    $actions[] =  new MessageTemplateActionBuilder($action->label, $action->value);;
58
            }
59
        }
60
61
        return $actions;
62
    }
63
64
    /**
65
     * {@inheritdoc}