11
11
12
12
use Latte ;
13
13
use Nette ;
14
+ use Nette \Bridges \ApplicationLatte ;
15
+ use Nette \Schema \Expect ;
14
16
15
17
16
18
/**
@@ -29,20 +31,17 @@ public function __construct(string $tempDir, bool $debugMode = false)
29
31
{
30
32
$ this ->tempDir = $ tempDir ;
31
33
$ this ->debugMode = $ debugMode ;
34
+ }
32
35
33
- $ this ->config = new class {
34
- /** @var bool */
35
- public $ xhtml = false ;
36
-
37
- /** @var string[] */
38
- public $ macros = [];
39
-
40
- /** @var ?string */
41
- public $ templateClass ;
42
36
43
- /** @var bool */
44
- public $ strictTypes = false ;
45
- };
37
+ public function getConfigSchema (): Nette \Schema \Schema
38
+ {
39
+ return Expect::structure ([
40
+ 'xhtml ' => Expect::bool (false ),
41
+ 'macros ' => Expect::arrayOf ('string ' ),
42
+ 'templateClass ' => Expect::string (),
43
+ 'strictTypes ' => Expect::bool (false ),
44
+ ]);
46
45
}
47
46
48
47
@@ -56,7 +55,7 @@ public function loadConfiguration()
56
55
$ builder = $ this ->getContainerBuilder ();
57
56
58
57
$ latteFactory = $ builder ->addFactoryDefinition ($ this ->prefix ('latteFactory ' ))
59
- ->setImplement (Nette \ Bridges \ ApplicationLatte \LatteFactory::class)
58
+ ->setImplement (ApplicationLatte \LatteFactory::class)
60
59
->getResultDefinition ()
61
60
->setFactory (Latte \Engine::class)
62
61
->addSetup ('setTempDirectory ' , [$ this ->tempDir ])
@@ -70,7 +69,7 @@ public function loadConfiguration()
70
69
71
70
$ builder ->addDefinition ($ this ->prefix ('templateFactory ' ))
72
71
->setType (Nette \Application \UI \TemplateFactory::class)
73
- ->setFactory (Nette \ Bridges \ ApplicationLatte \TemplateFactory::class)
72
+ ->setFactory (ApplicationLatte \TemplateFactory::class)
74
73
->setArguments (['templateClass ' => $ config ->templateClass ]);
75
74
76
75
foreach ($ config ->macros as $ macro ) {
0 commit comments