11<?php
22namespace Level2 \Router \Config ;
33class ModuleJson implements \Level2 \Router \Rule {
4+ private $ dice ;
45 private $ moduleDir ;
56 private $ configFile ;
6- private $ moduleNames ;
7- private $ jsonLoader ;
87 private $ request ;
98
109 public function __construct (\Dice \Dice $ dice , \Level2 \Core \Request $ request , $ moduleDir = 'Modules ' , $ configFile = 'manifest.json ' ) {
@@ -76,7 +75,7 @@ private function mergeConfig($orig, $ext) {
7675
7776 private function getModel ($ settings , $ name = '' ) {
7877 if (class_exists ($ settings ['instanceOf ' ])) {
79- $ this ->dice ->addRule ('$Model_ ' . $ name , $ settings );
78+ $ this ->dice = $ this -> dice ->addRule ('$Model_ ' . $ name , $ settings );
8079 $ model = $ this ->dice ->create ('$Model_ ' . $ name , [], []);
8180 }
8281 else {
@@ -86,7 +85,7 @@ private function getModel($settings, $name = '') {
8685 }
8786
8887 private function getRoute ($ routeSettings , $ route ) {
89- $ this ->dice ->addRule ('$View ' , $ routeSettings ['view ' ]);
88+ $ this -> dice = $ this ->dice ->addRule ('$View ' , $ routeSettings ['view ' ]);
9089
9190 if (isset ($ routeSettings ['model ' ])) {
9291 $ model = $ this ->getModel ($ routeSettings ['model ' ]);
@@ -113,7 +112,7 @@ private function getRoute($routeSettings, $route) {
113112 $ controllerRule ['call ' ][] = [$ action , $ route , function ($ return ) use (&$ model ) {
114113 if (is_object ($ return )) $ model = $ return ;
115114 }];
116- $ this ->dice ->addRule ('$controller ' , $ controllerRule );
115+ $ this -> dice = $ this ->dice ->addRule ('$controller ' , $ controllerRule );
117116 if (is_array ($ model )) {
118117 $ controller = $ this ->dice ->create ('$Controller ' , [], array_merge (array_values ($ model ), [$ this ->request ]));
119118 }
0 commit comments