Open Journal Systems  3.3.0
APIRouter Class Reference
Inheritance diagram for APIRouter:
PKPRouter

Public Member Functions

 getEntity ()
 
 getRequestedOp ($request)
 
 getVersion ()
 
 handleAuthorizationFailure ($request, $authorizationMessage)
 
 route ($request)
 
 supports ($request)
 
 url ($request, $newContext=null, $endpoint=null, $op=null, $path=null, $params=null, $anchor=null, $escape=false)
 
- Public Member Functions inherited from PKPRouter
 __construct ()
 
 _authorizeInitializeAndCallRequest (&$serviceEndpoint, $request, &$args, $validate=true)
 
 _contextLevelToContextName ($contextLevel)
 
 _contextNameToContextLevel ($contextName)
 
 _urlCanonicalizeNewContext ($newContext)
 
 _urlFromParts ($baseUrl, $pathInfoArray=array(), $queryParametersArray=array(), $anchor='', $escape=false)
 
 _urlGetAdditionalParameters ($request, $params=null, $escape=true)
 
 _urlGetBaseAndContext ($request, $newContext=array())
 
getApplication ()
 
 getCacheFilename ($request)
 
getContext ($request, $requestedContextLevel=1, $forceReload=false)
 
getContextByName ($request, $requestedContextName)
 
getDispatcher ()
 
 getHandler ()
 
 getIndexUrl ($request)
 
 getRequestedContextPath ($request, $requestedContextLevel=1)
 
 getRequestedContextPaths ($request)
 
 isCacheable ($request)
 
 setApplication ($application)
 
 setDispatcher ($dispatcher)
 
 setHandler ($handler)
 

Protected Member Functions

 getPathInfoParts ()
 

Additional Inherited Members

- Data Fields inherited from PKPRouter
 $_application
 
 $_contextDepth
 
 $_contextList
 
 $_contextPaths = array()
 
 $_contexts = array()
 
 $_dispatcher
 
 $_flippedContextList
 
 $_handler
 

Detailed Description

Map HTTP requests to a REST API using the Slim microframework.

Requests for [index.php]/api are intercepted for site-level API requests, and requests for [index.php]/{contextPath}/api are intercepted for context-level API requests.

Definition at line 24 of file APIRouter.inc.php.

Member Function Documentation

◆ getEntity()

APIRouter::getEntity ( )

Get the entity being requested

Returns
string

Definition at line 80 of file APIRouter.inc.php.

References Core\cleanFileVar(), and getPathInfoParts().

Referenced by route().

◆ getPathInfoParts()

APIRouter::getPathInfoParts ( )
protected

Determines path info parts depending of disable_path_info config value

Returns
array|NULL

Definition at line 30 of file APIRouter.inc.php.

References PKPRouter\getApplication(), and Config\getVar().

Referenced by getEntity(), getVersion(), and supports().

◆ getRequestedOp()

APIRouter::getRequestedOp (   $request)

Get the requested operation

Parameters
$requestPKPRequest
Returns
string

Definition at line 124 of file APIRouter.inc.php.

References PKPRouter\getHandler().

◆ getVersion()

APIRouter::getVersion ( )

Get the API version

Returns
string

Definition at line 71 of file APIRouter.inc.php.

References Core\cleanFileVar(), and getPathInfoParts().

Referenced by route().

◆ handleAuthorizationFailure()

APIRouter::handleAuthorizationFailure (   $request,
  $authorizationMessage 
)

Handle an authorization failure.

Parameters
$requestRequest
$authorizationMessagestring a translation key with the authorization failure message.

Reimplemented from PKPRouter.

Definition at line 142 of file APIRouter.inc.php.

References AppLocale\requireComponents().

◆ route()

APIRouter::route (   $request)

Routes a given request to a handler operation

Parameters
$requestPKPRequest

Reimplemented from PKPRouter.

Definition at line 91 of file APIRouter.inc.php.

References getEntity(), SessionManager\getManager(), getVersion(), AppLocale\requireComponents(), and PKPRouter\setHandler().

◆ supports()

APIRouter::supports (   $request)

Determines whether this router can route the given request.

Parameters
$requestPKPRequest
Returns
boolean true, if the router supports this request, otherwise false

Reimplemented from PKPRouter.

Definition at line 56 of file APIRouter.inc.php.

References getPathInfoParts().

◆ url()

APIRouter::url (   $request,
  $newContext = null,
  $endpoint = null,
  $op = null,
  $path = null,
  $params = null,
  $anchor = null,
  $escape = false 
)

Build a handler request URL into PKPApplication.

Parameters
$requestPKPRequest the request to be routed
$newContextmixed Optional contextual paths
$handlerstring Optional name of the handler to invoke
$opstring Optional name of operation to invoke
$pathmixed Optional string or array of args to pass to handler
$paramsarray Optional set of name => value pairs to pass as user parameters
$anchorstring Optional name of anchor to add to URL
$escapeboolean Whether or not to escape ampersands, square brackets, etc. for this URL; default false.
Returns
string the URL

Reimplemented from PKPRouter.

Definition at line 156 of file APIRouter.inc.php.

References $op, PKPRouter\_urlCanonicalizeNewContext(), PKPRouter\_urlFromParts(), PKPRouter\_urlGetAdditionalParameters(), and PKPRouter\_urlGetBaseAndContext().


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