1111
1212use Latte ;
1313use Nette ;
14+ use Nette \Bridges \ApplicationLatte ;
15+ use Nette \Schema \Expect ;
1416
1517
1618/**
@@ -29,20 +31,17 @@ public function __construct(string $tempDir, bool $debugMode = false)
2931 {
3032 $ this ->tempDir = $ tempDir ;
3133 $ this ->debugMode = $ debugMode ;
34+ }
3235
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 ;
4236
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+ ]);
4645 }
4746
4847
@@ -56,7 +55,7 @@ public function loadConfiguration()
5655 $ builder = $ this ->getContainerBuilder ();
5756
5857 $ latteFactory = $ builder ->addFactoryDefinition ($ this ->prefix ('latteFactory ' ))
59- ->setImplement (Nette \ Bridges \ ApplicationLatte \LatteFactory::class)
58+ ->setImplement (ApplicationLatte \LatteFactory::class)
6059 ->getResultDefinition ()
6160 ->setFactory (Latte \Engine::class)
6261 ->addSetup ('setTempDirectory ' , [$ this ->tempDir ])
@@ -70,7 +69,7 @@ public function loadConfiguration()
7069
7170 $ builder ->addDefinition ($ this ->prefix ('templateFactory ' ))
7271 ->setType (Nette \Application \UI \TemplateFactory::class)
73- ->setFactory (Nette \ Bridges \ ApplicationLatte \TemplateFactory::class)
72+ ->setFactory (ApplicationLatte \TemplateFactory::class)
7473 ->setArguments (['templateClass ' => $ config ->templateClass ]);
7574
7675 foreach ($ config ->macros as $ macro ) {
0 commit comments