@@ 116-131 (lines=16) @@ | ||
113 | static::trigger('start', $this, $args, $method); |
|
114 | ||
115 | // Call direct befores |
|
116 | if ( $this->befores ) { |
|
117 | // Reverse befores order |
|
118 | foreach (array_reverse($this->befores) as $mw) { |
|
119 | static::trigger('before', $this, $mw); |
|
120 | Event::trigger('core.route.before', $this, $mw); |
|
121 | ob_start(); |
|
122 | $mw_result = call_user_func($mw); |
|
123 | $raw_echoed = ob_get_clean(); |
|
124 | if ($append_echoed_text) Response::add($raw_echoed); |
|
125 | if ( false === $mw_result ) { |
|
126 | return ['']; |
|
127 | } else { |
|
128 | Response::add($mw_result); |
|
129 | } |
|
130 | } |
|
131 | } |
|
132 | ||
133 | $callback = (is_array($this->callback) && isset($this->callback[$method])) |
|
134 | ? $this->callback[$method] |
|
@@ 154-168 (lines=15) @@ | ||
151 | } |
|
152 | ||
153 | // Apply afters |
|
154 | if ( $this->afters ) { |
|
155 | foreach ($this->afters as $mw) { |
|
156 | static::trigger('after', $this, $mw); |
|
157 | Event::trigger('core.route.after', $this, $mw); |
|
158 | ob_start(); |
|
159 | $mw_result = call_user_func($mw); |
|
160 | $raw_echoed = ob_get_clean(); |
|
161 | if ($append_echoed_text) Response::add($raw_echoed); |
|
162 | if ( false === $mw_result ) { |
|
163 | return ['']; |
|
164 | } else { |
|
165 | Response::add($mw_result); |
|
166 | } |
|
167 | } |
|
168 | } |
|
169 | ||
170 | static::trigger('end', $this, $args, $method); |
|
171 | Event::trigger('core.route.end', $this); |