Skip to content

Commit 91b7fca

Browse files
committed
wip: refactor - working on $viewREADYTHING
1 parent 22b0390 commit 91b7fca

22 files changed

+906
-417
lines changed

go.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
* simply be executed directly here. This is useful for configuring the PHP
5050
* environment across the project, but shouldn't be necessary for most projects.
5151
*/
52+
// TODO: Investigate why requiring the composer autoloader emits a newline character, so we don't have to clear the output buffer in the go script.
53+
ob_clean();
5254
if(file_exists("setup.php")) {
5355
require("setup.php");
5456
}
@@ -65,3 +67,5 @@
6567
if(file_exists("teardown.php")) {
6668
require("teardown.php");
6769
}
70+
71+
die("go complete!");

src/Application.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public function start():void {
7171
// Before we start, we check if the current URI should be redirected. If it
7272
// should, we won't go any further into the lifecycle.
7373
$this->redirect->execute();
74+
7475
// The first thing done within the WebEngine lifecycle is start a timer.
7576
// This timer is only used again at the end of the call, when finish() is
7677
// called - at which point the entire duration of the request is logged out (and
@@ -86,7 +87,6 @@ public function start():void {
8687
// usage, the globals are protected against accidental misuse.
8788
$this->protectGlobals();
8889

89-
9090
// The RequestFactory takes the necessary global arrays to construct a
9191
// ServerRequest object. The $_SERVER array contains metadata about the request,
9292
// such as headers and server variables. $_FILES contains any uploaded files,
@@ -101,9 +101,18 @@ public function start():void {
101101
$this->globals["_POST"] ?? [],
102102
);
103103

104-
// TODO: Document what the Dispatcher's purpose is, and why it's important to
105-
// attach to the class as a property (for error states to be able to display
106-
// errors using the correct instance of the request, config, etc.)
104+
// The Dispatcher is a core component responsible for:
105+
// 1. Executing the application's routing logic to match the incoming request
106+
// 2. Running any middleware defined for the matched route
107+
// 3. Executing the appropriate page logic functions
108+
// 4. Generating and returning the HTTP response
109+
//
110+
// It's critical to store the Dispatcher as a class property because if an error
111+
// occurs during request processing, the error handling system needs access to
112+
// the same Dispatcher instance that has the original request context,
113+
// configuration, and other dependencies required to properly generate and
114+
// display error pages. This ensures errors can be handled consistently using
115+
// the application's error templates and logging mechanisms.
107116
$this->dispatcher = $this->dispatcherFactory->create(
108117
$this->config,
109118
$request,

0 commit comments

Comments
 (0)