BaseApiServiceSwitch
in package
implements
BaseSwitchContract
Uses
CachedEndpoints
This is the base class for the API service switch. It is used to switch between different services based on the request data.
The child class must implement the registerServices method to return an array of services.
It requires the request to define the SERVICE
key in the request data and the ACTION
key to define the action to be performed.
The SERVICE is the class that will be called when the SERVICE_NAME is called. The ACTION is the method that will be called on the SERVICE.
Tags
Table of Contents
Interfaces
Properties
- $app : PioniaApplication
- This is the application object
Methods
- cacheResponse() : BaseResponse|bool
- ping() : BaseResponse
- This is just for checking the api status
- processor() : BaseResponse
- This is the sole action to be called in the routes file. It processes the request and returns the response
- processServices() : BaseResponse
- This method checks the request data for the `SERVICE` key and processes the service based on it
Properties
$app
This is the application object
public
PioniaApplication
$app
Methods
cacheResponse()
public
static cacheResponse(Request $request) : BaseResponse|bool
Parameters
- $request : Request
Return values
BaseResponse|boolping()
This is just for checking the api status
public
ping(Request $request) : BaseResponse
You can even override it in your own switch class
Parameters
- $request : Request
Return values
BaseResponseprocessor()
This is the sole action to be called in the routes file. It processes the request and returns the response
public
static processor(Request $request) : BaseResponse
Parameters
- $request : Request
Tags
Return values
BaseResponseprocessServices()
This method checks the request data for the `SERVICE` key and processes the service based on it
private
static processServices(Request $request, ApplicationContract $app) : BaseResponse
Parameters
- $request : Request
-
The request object
- $app : ApplicationContract
-
The application instance
Tags
Return values
BaseResponse —The response object