Menu

## MainSwitch extends BaseApiServiceSwitch
in package

MainSwitch.php : 15

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.

### Table of Contents

#### 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
registerServices() : Arrayable
  Register services here
processServices() : BaseResponse
  This method checks the request data for the `SERVICE` key and processes the service based on it

### Properties

#### $app

BaseApiServiceSwitch.php : 38

This is the application object

`public PioniaApplication $app`

### Methods

#### cacheResponse()

CachedEndpoints.php : 13
`public static cacheResponse(Request $request) : BaseResponse|bool`

##### Parameters

$request : Request

##### Return values

BaseResponse|bool

#### ping()

BaseApiServiceSwitch.php : 115

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

BaseResponse

#### processor()

BaseApiServiceSwitch.php : 93

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

throws
  Throwable

##### Return values

BaseResponse

#### registerServices()

MainSwitch.php : 20

Register services here

`public registerServices() : Arrayable`

##### Return values

Arrayable

#### processServices()

BaseApiServiceSwitch.php : 48

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

throws
  Throwable

##### Return values

BaseResponse —

The response object

## Search results