File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change 77use Fenom ;
88use Fenom \Error \CompileException ;
99use Fenom \Provider ;
10+ use Qubus \Config \ConfigContainer ;
11+ use Qubus \Exception \Data \TypeException ;
12+ use Qubus \Exception \Exception ;
1013use Qubus \View \Renderer ;
1114
1215use function Codefy \Framework \Helpers \config ;
@@ -15,13 +18,17 @@ final class FenomView implements Renderer
1518{
1619 private Fenom $ fenom ;
1720
18- public function __construct ()
21+ /**
22+ * @throws TypeException
23+ * @throws Exception
24+ */
25+ public function __construct (protected ConfigContainer $ configContainer )
1926 {
2027 $ this ->fenom = (new Fenom (
21- provider: new Provider (template_dir: config (key: 'view.path ' ))
28+ provider: new Provider (template_dir: $ this -> configContainer -> getConfigKey (key: 'view.path ' ))
2229 ))->setCompileDir (
23- dir: config (key: 'view.cache ' )
24- )->setOptions (options: config (key: 'view.options ' ));
30+ dir: $ this -> configContainer -> getConfigKey (key: 'view.cache ' )
31+ )->setOptions (options: $ this -> configContainer -> getConfigKey (key: 'view.options ' ));
2532 }
2633
2734 /**
Original file line number Diff line number Diff line change 55namespace Codefy \Framework \View ;
66
77use Foil \Engine ;
8+ use Qubus \Config \ConfigContainer ;
9+ use Qubus \Exception \Data \TypeException ;
10+ use Qubus \Exception \Exception ;
811use Qubus \View \Renderer ;
912
1013use function Codefy \Framework \Helpers \config ;
@@ -14,9 +17,13 @@ final class FoilView implements Renderer
1417{
1518 private Engine $ engine ;
1619
17- public function __construct ()
20+ /**
21+ * @throws TypeException
22+ * @throws Exception
23+ */
24+ public function __construct (protected ConfigContainer $ configContainer )
1825 {
19- $ this ->engine = engine (config (key: 'view.options ' ));
26+ $ this ->engine = engine ($ this -> configContainer -> getConfigKey (key: 'view.options ' ));
2027 }
2128
2229 public function render (array |string $ template , array $ data = []): string |array
You can’t perform that action at this time.
0 commit comments