static test

This commit is contained in:
2025-04-25 21:27:31 -04:00
parent 025bc2d924
commit ac99a78bdf
9 changed files with 103 additions and 14 deletions

View File

@@ -15,7 +15,7 @@ use Siteworx\Config\Exception\UnsupportedFormatException;
* This class serves as a facade for the configuration settings of the application.
* It extends the Facade class from the Illuminate\Support\Facades namespace.
*
* @method static string|int|bool|float get(string $key) Retrieve the configuration value for the given key.
* @method static bool | string | int get(string $key) Retrieve the configuration value for the given key.
*
* @package Siteworx\App\Facades
*/

View File

@@ -16,7 +16,7 @@ class JsonResponseFactory
/**
* Create a JSON response with the given data and status code.
*
* @param mixed $data The data to include in the response.
* @param array $data The data to include in the response.
* @param int $statusCode The HTTP status code for the response.
* @return Response The JSON response.
* @throws \JsonException

View File

@@ -34,7 +34,7 @@ class CorsMiddleware implements MiddlewareInterface
'trim',
explode(
',',
Config::get('CORS_ALLOWED_ORIGINS', 'https://example.com,https://another.com')
Config::get('cors.allowed_origins')
)
);
@@ -57,11 +57,11 @@ class CorsMiddleware implements MiddlewareInterface
?: 'Content-Type, Authorization'
);
if (Config::get('CORS_ALLOW_CREDENTIALS', 'bool')) {
if (Config::get('cors.allow_credentials') === true) {
$response = $response->withHeader('Access-Control-Allow-Credentials', 'true');
}
$maxAge = Config::get('CORS_MAX_AGE') ?: '86400';
$maxAge = Config::get('CORS_MAX_AGE') !== 3600 ? Config::get('CORS_MAX_AGE') : 3600;
return $response->withHeader('Access-Control-Max-Age', $maxAge);
}

View File

@@ -16,12 +16,13 @@ use Spiral\RoadRunner\Http\PSR7Worker;
use Spiral\RoadRunner\Worker;
/**
* Abstract class Server
* Class Server
*
* This abstract class serves as a base for creating server instances.
* It initializes the PSR-7 worker and router, and provides an abstract method
* for registering routes. It also includes a method to start the server and handle
* incoming requests.
* This class represents the main server application.
* It handles incoming HTTP requests, routes them to the appropriate handlers,
* and manages the server lifecycle.
*
* @package Siteworxpro\App
*/
class Server
{
@@ -153,7 +154,7 @@ class Server
Logger::error($e->getTraceAsString());
$json = ['status_code' => 500, 'reason_phrase' => 'Server Error'];
if (Config::get("DEV_MODE", 'bool')) {
if (Config::get("server.dev_mode")) {
$json = [
'status_code' => 500,
'reason_phrase' => 'Server Error',