Dotclear 2.24
Loading...
Searching...
No Matches
restServer Class Reference

REST Server. More...

Inheritance diagram for restServer:
dcRestServer

Public Member Functions

 __construct ()
 
 addFunction (string $name, $callback)
 
 serve (string $encoding='UTF-8')
 

Data Fields

 $rsp
 
 $functions = []
 

Protected Member Functions

 callFunction (string $name, array $get, array $post)
 

Detailed Description

REST Server.

A very simple REST server implementation

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Constructor

Reimplemented in dcRestServer.

Member Function Documentation

◆ addFunction()

addFunction ( string  $name,
  $callback 
)

Add Function

This adds a new function to the server. $callback should be a valid PHP callback. Callback function takes two arguments: GET and POST values.

Parameters
string$nameFunction name
callable | array$callbackCallback function

◆ callFunction()

callFunction ( string  $name,
array  $get,
array  $post 
)
protected

Call Function

This method calls callback named $name.

Parameters
string$nameFunction name
array$getGET values
array$postPOST values
Returns
mixed

Reimplemented in dcRestServer.

Referenced by serve().

◆ serve()

serve ( string  $encoding = 'UTF-8')

Main server

This method creates the main server.

Parameters
string$encodingServer charset
Returns
bool

Reimplemented in dcRestServer.

References callFunction().

Field Documentation

◆ $rsp

$rsp

◆ $functions

$functions = []

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