\Pydio\Core\HttpSimpleRestResourceRouter

Class SimpleRestResourceRouter FastRoute encapsuler that can be used to make a simple CRUD Rest API on an existing route of the application.

Summary

Methods
Properties
Constants
__construct()
addRoute()
configureRoutes()
getURIForRequest()
route()
cast()
No public properties found
No constants found
simpleHandler()
bodyHandler()
No protected properties found
N/A
No private methods found
$config
$cacheOptions
$callbacksContext
$base
N/A

Properties

$config

$config : array

Type

array — ["resourceName" => "name", "parameterName" => "object_id" "crudCallbacks" => ["CREATE" => methodName, "RETRIEVE_MANY"=> methodName, "RETRIEVE_ONE"=> methodName, "UPDATE" => methodName, "DELETE" => methodName], "linkedResources" => [NESTED CONFIG ARRAY] "additionalRoutes" => [[method=>"GET", uri=>"/path/to/route", callable]] ]

$cacheOptions

$cacheOptions : array

Type

array — "cacheOptions" => ["cacheFile" => "path", "cacheDisabled" => true],

$callbacksContext

$callbacksContext : object

Type

object — Will be used as '$this' for triggering the callbacks

$base

$base : 

Type

Methods

__construct()

__construct(object  $callbacksContext, array  $config, array  $cacheOptions) 

SimpleRestResourceRouter constructor.

Parameters

object $callbacksContext
array $config
array $cacheOptions

addRoute()

addRoute(  $method,   $uri,   $callable) 

Parameters

$method
$uri
$callable

configureRoutes()

configureRoutes(  $base, array  $configObject, \FastRoute\RouteCollector  $r) 

Parameters

$base
array $configObject
\FastRoute\RouteCollector $r

getURIForRequest()

getURIForRequest(\Psr\Http\Message\ServerRequestInterface  $request) : string

Parameters

\Psr\Http\Message\ServerRequestInterface $request

Returns

string

route()

route(\Psr\Http\Message\ServerRequestInterface  $request, \Psr\Http\Message\ResponseInterface  $response) : boolean

Parameters

\Psr\Http\Message\ServerRequestInterface $request
\Psr\Http\Message\ResponseInterface $response

Returns

boolean

cast()

cast(string|object  $destination, object  $sourceObject) : mixed

Class casting

Parameters

string|object $destination
object $sourceObject

Returns

mixed

simpleHandler()

simpleHandler(callable  $callback, \Psr\Http\Message\ServerRequestInterface  $requestInterface, \Psr\Http\Message\ResponseInterface  $responseInterface) 

Parameters

callable $callback
\Psr\Http\Message\ServerRequestInterface $requestInterface
\Psr\Http\Message\ResponseInterface $responseInterface

bodyHandler()

bodyHandler(callable  $callback, \Psr\Http\Message\ServerRequestInterface  $request, \Psr\Http\Message\ResponseInterface  $response) 

Parameters

callable $callback
\Psr\Http\Message\ServerRequestInterface $request
\Psr\Http\Message\ResponseInterface $response