Skip to content
Merged

Dev #273

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f8af600
chore: Pump-Up Database to V1.2
usernane Nov 6, 2025
44940b6
refactor: Removal of `SettingsCommand`
usernane Nov 10, 2025
69cc5a2
refactor: Removal of the Command `ListRoutes`
usernane Nov 10, 2025
d64ff59
refactor: Removal of `ListThemesCommand`
usernane Nov 10, 2025
aeb7688
refactor: Removal of the Class `RunSQLCommand`
usernane Nov 10, 2025
ba1e132
refactor: Removal of `UpdateTable` Command
usernane Nov 10, 2025
3a38888
test: Updated Config
usernane Nov 10, 2025
641c4cf
chore: Updated Core Libraries
usernane Jan 12, 2026
dc3d8b6
refactor: Add Request and Response to `App`
usernane Jan 13, 2026
79f47a8
fix: Getting Requested URI
usernane Jan 13, 2026
a27c9db
refactor: Add Return Type
usernane Jan 13, 2026
5962d70
refactor: Add Return Type
usernane Jan 13, 2026
f4900b5
refactor: Fixes
usernane Jan 13, 2026
d87928c
refactor: Extends `RequestUri` instead of `Uri`
usernane Jan 13, 2026
49b134b
refactor: Namespace Correction
usernane Jan 13, 2026
1803a92
refactor: Use of `getAll` Instead of `METHODS`
usernane Jan 13, 2026
8d09e6e
refactor: Add Return Type
usernane Jan 13, 2026
3673e32
refactor: Use `App` for Request and Response
usernane Jan 13, 2026
bd09605
fix: Multiple Fixes
usernane Jan 13, 2026
54ee125
test: Fix Test Cases
usernane Jan 14, 2026
5751948
test: Expected Max and Min to Null
usernane Jan 14, 2026
602a5ba
Update RunMigrationsCommandTest.php
usernane Jan 14, 2026
b57b6bc
fix: Max/Min Values Issue
usernane Jan 14, 2026
f318ba4
fix: Fix Session Tables Creation
usernane Jan 14, 2026
7d230c9
chore: Update Sonar Config
usernane Jan 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions App/Apis/RoutingTestClass.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php
namespace App\Apis;

use WebFiori\Http\Response;
use WebFiori\Framework\App;

class RoutingTestClass {
public function __construct(?string $param = null, ?string $second = null) {
Response::write("I'm inside the class.");
App::getResponse()->write("I'm inside the class.");
}
public function doSomething() {
Response::clear();
Response::write("I'm doing something.");
App::getResponse()->clear();
App::getResponse()->write("I'm doing something.");
}
public function doSomethingExtra(?string $p1 = null, ?string $p2 = null) {
Response::clear();
Response::write("I'm doing something.");
App::getResponse()->clear();
App::getResponse()->write("I'm doing something.");
}
}
56 changes: 44 additions & 12 deletions WebFiori/Framework/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ class App {
* @since 1.0
*/
private static $LC;
/**
* Current request instance.
*
* @var Request
*/
private static $Request;
/**
* Current response instance.
*
* @var Response
*/
private static $Response;

/**
* The entry point for initiating the system.
Expand All @@ -124,6 +136,10 @@ private function __construct() {

//Initialize CLI
self::getRunner();

//Initialize Request and Response
self::$Request = Request::createFromGlobals();
self::$Response = new Response();

$this->initThemesPath();

Expand All @@ -137,7 +153,7 @@ private function __construct() {
$this->initMiddleware();
$this->initRoutes();
$this->initScheduler();
Response::beforeSend(function ()
self::getResponse()->beforeSend(function ()
{
register_shutdown_function(function()
{
Expand All @@ -146,7 +162,7 @@ private function __construct() {
$mdArr = $uriObj->getMiddleware();

for ($x = count($mdArr) - 1 ; $x > 0 ; $x--) {
$mdArr[$x]->afterSend(Request::get(), Response::get());
$mdArr[$x]->afterSend(self::getRequest(), self::getResponse());
}
}
});
Expand All @@ -157,7 +173,7 @@ private function __construct() {
$mdArr = $uriObj->getMiddleware();

for ($x = count($mdArr) - 1 ; $x > 0 ; $x--) {
$mdArr[$x]->after(Request::get(), Response::get());
$mdArr[$x]->after(self::getRequest(), self::getResponse());
}
}
});
Expand Down Expand Up @@ -305,8 +321,8 @@ public static function handle() {
App::getRunner()->start();
} else {
//route user request.
Router::route(Request::getRequestedURI());
Response::send();
Router::route(self::getRequest()->getRequestedURI());
self::getResponse()->send();
}
}
}
Expand Down Expand Up @@ -423,15 +439,15 @@ public static function getRunner() : Runner {
$commands = [
'\\WebFiori\\Framework\\Cli\\Commands\\WHelpCommand',
'\\WebFiori\\Framework\\Cli\\Commands\\VersionCommand',
'\\WebFiori\\Framework\\Cli\\Commands\\SettingsCommand',

'\\WebFiori\\Framework\\Cli\\Commands\\SchedulerCommand',
'\\WebFiori\\Framework\\Cli\\Commands\\CreateCommand',
'\\WebFiori\\Framework\\Cli\\Commands\\AddCommand',
'\\WebFiori\\Framework\\Cli\\Commands\\ListRoutesCommand',
'\\WebFiori\\Framework\\Cli\\Commands\\ListThemesCommand',
'\\WebFiori\\Framework\\Cli\\Commands\\RunSQLQueryCommand',
'\\WebFiori\\Framework\\Cli\\Commands\\UpdateSettingsCommand',
'\\WebFiori\\Framework\\Cli\\Commands\\UpdateTableCommand',





'\\WebFiori\\Framework\\Cli\\Commands\\RunMigrationsCommand',
];

Expand Down Expand Up @@ -724,7 +740,7 @@ private function initRoutes() {
* @throws FileException
*/
private function initScheduler() {
$uriObj = new RouterUri(Request::getRequestedURI(), '');
$uriObj = new RouterUri(self::getRequest()->getUri()->getUri(true, true), '');
$pathArr = $uriObj->getPathArray();

if (!class_exists(APP_DIR.'\Init\InitTasks')) {
Expand Down Expand Up @@ -764,4 +780,20 @@ private function setHandlers() {
// Handler::registerHandler(new HTTPErrHandler());
// Handler::unregisterHandler(Handler::getHandler('Default'));
}
/**
* Returns the current request instance.
*
* @return Request
*/
public static function getRequest() : Request {
return self::$Request;
}
/**
* Returns the current response instance.
*
* @return Response
*/
public static function getResponse() : Response {
return self::$Response;
}
}
56 changes: 0 additions & 56 deletions WebFiori/Framework/Cli/Commands/ListRoutesCommand.php

This file was deleted.

100 changes: 0 additions & 100 deletions WebFiori/Framework/Cli/Commands/ListThemesCommand.php

This file was deleted.

Loading