1 | <?php |
||
11 | class LatteServiceProvider implements ServiceProviderInterface |
||
12 | { |
||
13 | /** |
||
14 | * {@inheritdoc} |
||
15 | */ |
||
16 | public function register(ContainerInterface $app) |
||
17 | { |
||
18 | $app->closure(Engine::class, function (Config $config) { |
||
19 | $engine = new Engine(); |
||
20 | $engine->setLoader(new FileLoader()); |
||
21 | $cachePath = $config->get('view.cache'); |
||
22 | if ($cachePath) { |
||
23 | $engine->setTempDirectory($cachePath); |
||
24 | } |
||
25 | return $engine; |
||
26 | }); |
||
27 | $app->closure(RenderInterface::class, function (Engine $engine, Config $config) { |
||
28 | return new LatteView( |
||
29 | $engine, |
||
30 | $config->get('view.path') |
||
31 | ); |
||
32 | }); |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * {@inheritdoc} |
||
37 | */ |
||
38 | public function boot(ContainerInterface $app) |
||
41 | } |
||
42 |