File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 55namespace DoWStarterTheme \Common \View ;
66
77use DoWStarterTheme \Common \Config \Config ;
8+ use DoWStarterTheme \Deps \DI \Container ;
89
910/**
1011 * View Composer Repository class
@@ -28,10 +29,12 @@ class ViewComposerRepository
2829 /**
2930 * Class constructor.
3031 *
31- * @param Config $config Config instance.
32+ * @param Config $config Config instance.
33+ * @param Container $container Container instance.
3234 */
3335 public function __construct (
3436 private Config $ config ,
37+ private Container $ container ,
3538 ) {
3639 $ this ->registerComposers ();
3740 }
@@ -83,8 +86,7 @@ private function mapComposerToViews(string $composer): void
8386 private function getComposer (string $ composer ): ViewComposer
8487 {
8588 if (! isset ($ this ->composers [$ composer ])) {
86- // phpcs:ignore NeutronStandard.Functions.VariableFunctions.VariableFunction
87- $ this ->composers [$ composer ] = new $ composer ();
89+ $ this ->composers [$ composer ] = $ this ->container ->get ($ composer );
8890 }
8991
9092 return $ this ->composers [$ composer ];
You can’t perform that action at this time.
0 commit comments