File tree Expand file tree Collapse file tree 4 files changed +15
-18
lines changed Expand file tree Collapse file tree 4 files changed +15
-18
lines changed Original file line number Diff line number Diff line change @@ -174,7 +174,7 @@ public function __construct(
174174 );
175175 $ this ->viewModelProcessor = $ viewModelInit ->getViewModelProcessor ();
176176 $ this ->viewREADYTHING = fn () => $ viewModelInit ->initHTMLDocument (
177- $ this ->serviceContainer ->get (DocumentBinder ::class),
177+ $ this ->serviceContainer ->get (Binder ::class),
178178 $ this ->serviceContainer ->get (HTMLAttributeBinder::class),
179179 $ this ->serviceContainer ->get (ListBinder::class),
180180 $ this ->serviceContainer ->get (TableBinder::class),
@@ -237,7 +237,7 @@ public function generateResponse():Response {
237237 }
238238
239239// TODO: Why is this here in the dispatcher? Move it to the ViewModel::cleanup() or similar
240- $ documentBinder = $ this ->serviceContainer ->get (DocumentBinder ::class);
240+ $ documentBinder = $ this ->serviceContainer ->get (Binder ::class);
241241 $ documentBinder ->cleanupDocument ();
242242
243243 $ this ->viewStreamer ->stream ($ this ->view , $ this ->viewModel );
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ public function __construct(
3737 }
3838
3939 public function initHTMLDocument (
40- DocumentBinder $ binder ,
40+ DocumentBinder $ documentBinder ,
4141 HTMLAttributeBinder $ htmlAttributeBinder ,
4242 ListBinder $ listBinder ,
4343 TableBinder $ tableBinder ,
@@ -70,7 +70,7 @@ public function initHTMLDocument(
7070 $ bindableCache ,
7171 $ tableBinder ,
7272 );
73- $ binder ->setDependencies (
73+ $ documentBinder ->setDependencies (
7474 $ elementBinder ,
7575 $ placeholderBinder ,
7676 $ tableBinder ,
Original file line number Diff line number Diff line change 3131 * responsibilities focused and testable.
3232 */
3333class DefaultServiceLoader {
34+ protected string $ uniqid ;
35+
3436 public function __construct (
3537 protected Config $ config ,
3638 protected Container $ container
37- ) {}
39+ ) {
40+ $ this ->uniqid = uniqid (more_entropy: true );
41+ }
3842
3943 public function loadResponseHeaders ():ResponseHeaders {
4044 $ response = $ this ->container ->get (Response::class);
@@ -91,7 +95,7 @@ public function loadListBinder():ListBinder {
9195 return new ListBinder ();
9296 }
9397
94- public function loadBinder ():DocumentBinder {
98+ public function loadBinder ():Binder {
9599 $ document = $ this ->container ->get (Document::class);
96100 return new DocumentBinder ($ document );
97101 }
Original file line number Diff line number Diff line change @@ -9,25 +9,18 @@ class ContainerFactory {
99 public function create (Config $ config ):Container {
1010 $ container = new Container ();
1111
12- // Always register the DefaultServiceLoader for core WebEngine services.
13- $ container ->addLoaderClass (new DefaultServiceLoader ($ config , $ container ));
14-
1512 // Optionally, register an application-provided service loader.
1613 $ customServiceContainerClassName = implode ("\\" , [
1714 $ config ->get ("app.namespace " ),
1815 $ config ->get ("app.service_loader " ),
1916 ]);
2017
2118 if (class_exists ($ customServiceContainerClassName )) {
22- $ constructorArgs = [];
23- if (is_a ($ customServiceContainerClassName , DefaultServiceLoader::class, true )) {
24- $ constructorArgs = [
25- $ config ,
26- $ container ,
27- ];
28- }
29-
30- $ container ->addLoaderClass (new $ customServiceContainerClassName (...$ constructorArgs ));
19+ $ container ->addLoaderClass (new $ customServiceContainerClassName ($ config , $ container ));
20+ }
21+ else {
22+ // Always register the DefaultServiceLoader for core WebEngine services.
23+ $ container ->addLoaderClass (new DefaultServiceLoader ($ config , $ container ));
3124 }
3225
3326 return $ container ;
You can’t perform that action at this time.
0 commit comments