Conditions | 3 |
Paths | 4 |
Total Lines | 26 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
28 | final public function displayModuleContent($method, $args) { |
||
29 | // if method not callbale abort to 'not found' |
||
30 | if (! is_callable([$this, $method])) abort(404); |
||
31 | |||
32 | // if user has no access abort 'no access' |
||
33 | if (! $this->access()) abort(401); |
||
34 | |||
35 | $args = $this->decodeArgs($args); |
||
36 | |||
37 | // set the associative array keys as view properties |
||
38 | $this->setDefaults($args); |
||
39 | |||
40 | // filter for entries with numeric keys use values as method arguments |
||
41 | $args = array_filter($args, function($key) { |
||
42 | return is_numeric($key); |
||
43 | }, ARRAY_FILTER_USE_KEY); |
||
44 | |||
45 | ksort($args); |
||
46 | |||
47 | // method can add seeds to the module seed |
||
48 | // the content echoed in the method is assigned to the module view content region |
||
49 | ob_start(); |
||
50 | $this->{$method}(...$args); |
||
51 | $content = ob_get_clean(); |
||
52 | |||
53 | $this->set('Content', $content); |
||
54 | } |
||
56 |