\API

Class API Contains all the routes and their classes

Summary

Methods
Properties
Constants
__construct()
return_error()
route()
process_route()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$routes
N/A

Properties

$routes

$routes : array

Array contains all the routes for the rest API

Type

array

Methods

__construct()

__construct() 

return_error()

return_error(string  $message) 

Sends error to the screen

Parameters

string $message

Error message to JSON encode and send to the browser

route()

route(string  $method, string  $regexp, \APIPage  $apiView, boolean  $auth) 

Adds a route for requests

Parameters

string $method

HTTP method in [GET, PUT, POST, DELETE]

string $regexp

Regular expression to match URL

\APIPage $apiView

Object to handle displaying of data

boolean $auth

Checks for authentication if true

process_route()

process_route(string  $url) 

Look through URL Regex's for a match and if a match then render output.

Parameters

string $url

URL to run regular expressions against.