Code Duplication    Length = 7-9 lines in 5 locations

src/Controller/AppController.php 1 location

@@ 109-115 (lines=7) @@
106
     *
107
     * @return  void
108
     */
109
    public function beforeRedirect(Event $event, $url, Response $response)
110
    {
111
        $pluginEvent = Plugin::getData('Core', 'Controller.beforeRedirect');
112
        if (is_callable($pluginEvent->find(0)) && Plugin::hasManifestEvent('Controller.beforeRedirect')) {
113
            call_user_func_array($pluginEvent->find(0), [$this, $event, $url, $response]);
114
        }
115
    }
116
117
    /**
118
     * Called after the controller action is run and rendered.

src/View/Helper/DocumentHelper.php 4 locations

@@ 83-91 (lines=9) @@
80
     *
81
     * @throws  \JBZoo\Utils\Exception
82
     */
83
    public function afterRender(Event $event, $viewFile)
84
    {
85
        $this->_setupMetaData();
86
87
        $pluginEvent = Plugin::getData('Core', 'View.afterRender');
88
        if (is_callable($pluginEvent->find(0)) && Plugin::hasManifestEvent('View.afterRender')) {
89
            call_user_func_array($pluginEvent->find(0), [$this->_View, $event, $viewFile]);
90
        }
91
    }
92
93
    /**
94
     * Is called after each view file is rendered. This includes elements, views, parent views and layouts.
@@ 66-72 (lines=7) @@
63
     *
64
     * @throws  \JBZoo\Utils\Exception
65
     */
66
    public function afterLayout(Event $event, $layoutFile)
67
    {
68
        $pluginEvent = Plugin::getData('Core', 'View.afterLayout');
69
        if (is_callable($pluginEvent->find(0)) && Plugin::hasManifestEvent('View.afterLayout')) {
70
            call_user_func_array($pluginEvent->find(0), [$this->getView(), $event, $layoutFile]);
71
        }
72
    }
73
74
    /**
75
     * Is called after the view has been rendered but before layout rendering has started.
@@ 138-144 (lines=7) @@
135
     *
136
     * @throws  \JBZoo\Utils\Exception
137
     */
138
    public function beforeLayout(Event $event, $layoutFile)
139
    {
140
        $pluginEvent = Plugin::getData('Core', 'View.beforeLayout');
141
        if (is_callable($pluginEvent->find(0)) && Plugin::hasManifestEvent('View.beforeLayout')) {
142
            call_user_func_array($pluginEvent->find(0), [$this->getView(), $event, $layoutFile]);
143
        }
144
    }
145
146
    /**
147
     * Is called after the controller’s beforeRender method but before the controller renders view and layout.
@@ 176-182 (lines=7) @@
173
     *
174
     * @throws  \JBZoo\Utils\Exception
175
     */
176
    public function beforeRenderFile(Event $event, $viewFile)
177
    {
178
        $pluginEvent = Plugin::getData('Core', 'View.beforeRenderFile');
179
        if (is_callable($pluginEvent->find(0)) && Plugin::hasManifestEvent('View.beforeRenderFile')) {
180
            call_user_func_array($pluginEvent->find(0), [$this->getView(), $event, $viewFile]);
181
        }
182
    }
183
184
    /**
185
     * Get body classes by view data.