TradeBench 1.0.0
Algorithmic Trading Backtesting Platform
Loading...
Searching...
No Matches
Static Public Member Functions
App\Core\Response Class Reference

Utility class for standardizing JSON HTTP responses. More...

Static Public Member Functions

static json (array $data, int $statusCode=200)
 Sends a successful JSON response and terminates execution.
 
static error (string $message, int $statusCode=400, $details=null)
 Sends an error JSON response and either throws an exception (in CLI) or terminates execution.
 

Detailed Description

Utility class for standardizing JSON HTTP responses.

Member Function Documentation

◆ error()

static App\Core\Response::error ( string $message,
int $statusCode = 400,
$details = null )
static

Sends an error JSON response and either throws an exception (in CLI) or terminates execution.

Parameters
string$messageThe error message to display.
int$statusCodeHTTP status code (default: 400).
mixed$detailsAdditional debugging information.
Exceptions

Exception When running in CLI mode (PHPUnit compatibility).

◆ json()

static App\Core\Response::json ( array $data,
int $statusCode = 200 )
static

Sends a successful JSON response and terminates execution.

Parameters
array$dataThe payload to return.
int$statusCodeHTTP status code (default: 200).

The documentation for this class was generated from the following file: