Conditions | 6 |
Paths | 1 |
Total Lines | 26 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
9 | public function register(Plates\Engine $plates) { |
||
10 | $c = $plates->getContainer(); |
||
11 | $c->add('path.resolvePath.stack', function($c) { |
||
12 | $config = $c->get('config'); |
||
13 | |||
14 | // wrap base dir in an array if not already |
||
15 | $base_dir = isset($config['base_dir']) ? $config['base_dir'] : null; |
||
16 | $base_dir = $base_dir ? (is_string($base_dir) ? [$base_dir] : $base_dir) : $base_dir; |
||
17 | |||
18 | return array_filter([ |
||
19 | 'relative' =>relativeResolvePath(), |
||
20 | 'ext' => isset($config['ext']) ? extResolvePath($config['ext']) : null, |
||
21 | 'prefix' => $base_dir ? prefixResolvePath($base_dir, $c->get('fileExists')) : null, |
||
22 | 'id' => idResolvePath(), |
||
23 | ]); |
||
24 | }); |
||
25 | $c->add('path.resolvePath', function($c) { |
||
26 | return Plates\Util\stack($c->get('path.resolvePath.stack')); |
||
27 | }); |
||
28 | $c->wrap('compose', function($compose, $c) { |
||
29 | return Plates\Util\compose( |
||
30 | $compose, |
||
31 | resolvePathCompose($c->get('path.resolvePath')) |
||
32 | ); |
||
33 | }); |
||
34 | } |
||
35 | } |
||
36 |