PHP Класс Webiny\Component\Rest\Response\Router

Наследование: use trait Webiny\Component\Http\HttpTrait, use trait Webiny\Component\StdLib\StdLibTrait
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( string $api, string $class, boolean $normalize, Cache $compilerCache ) Base constructor.
getMethod ( ) : string Get the http method.
getUrl ( ) : string Returns the current url path.
processRequest ( ) : CallbackResult Process the api rest request and return the CallbackResult object.
setHttpMethod ( string $method ) Force sets the http method.
setUrl ( string $url ) Set the url.

Приватные методы

Метод Описание
doesPatternMatch ( string $pattern, array $data, string $url ) : boolean Checks if $pattern matches $url.
getVersion ( ) : string Check if there is a specific version set in the request headers, if not, it returns 'current' version.
matchDefaultMethod ( array $callbacks, string $url, $classUrl ) : array This is the fallback method that tries to match a default method.
matchMethod ( array $callbacks, string $url ) : array Does the matching of method if method name is present in the url.
matchRequest ( array &$classData ) : CallbackResult Analyzes the request and tries to match an api method.
tryMatchingOptionalParams ( string $pattern, array $data, string $url ) : boolean This method adds the default values for missing parameters and tries to do the match again.

Описание методов

__construct() публичный Метод

Base constructor.
public __construct ( string $api, string $class, boolean $normalize, Cache $compilerCache )
$api string Name of the rest api configuration.
$class string Name of the rest api class.
$normalize boolean Should the url parts be normalized or not.
$compilerCache Webiny\Component\Rest\Compiler\Cache Current compiler cache instance.

getMethod() публичный Метод

Get the http method.
public getMethod ( ) : string
Результат string

getUrl() публичный Метод

Returns the current url path.
public getUrl ( ) : string
Результат string

processRequest() публичный Метод

Process the api rest request and return the CallbackResult object.
public processRequest ( ) : CallbackResult
Результат CallbackResult

setHttpMethod() публичный Метод

Force sets the http method.
public setHttpMethod ( string $method )
$method string Method name.

setUrl() публичный Метод

In case a fixed url string is passed directly into the Rest instance, using this method the url will be passed to the router.
public setUrl ( string $url )
$url string Url upon which we will try to match a service in the registered class.