PHP Класс Imbo\EventListener\Cors

This event listener will listen to all incoming OPTIONS requests and adds the correct headers required for CORS to function properly - all configured on a per-user/resource base.
Автор: Espen Hovlandsdal ([email protected])
Наследование: implements Imbo\EventListener\ListenerInterface
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
__construct ( array $params = [] ) Class constructor
getAllowedOrigins ( ) : array Returns an array of allowed origins
getSubscribedEvents ( )
invoke ( Imbo\EventManager\EventInterface $event ) Handle other requests
options ( Imbo\EventManager\EventInterface $event ) Handle the OPTIONS requests
setExposedHeaders ( Imbo\EventManager\EventInterface $event ) Right before the response is sent to the client, whitelist all included Imbo-headers in the "Access-Control-Expose-Headers"-header
subscribe ( Imbo\EventManager\EventInterface $event ) Subscribe to events based on configuration parameters

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

Метод Описание
originIsAllowed ( string $origin ) : boolean Check if the given origin is defined as an allowed origin

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

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

Class constructor
public __construct ( array $params = [] )
$params array Parameters for the listener

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

Returns an array of allowed origins
public getAllowedOrigins ( ) : array
Результат array The defined allowed origins

getSubscribedEvents() публичный статический Метод

public static getSubscribedEvents ( )

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

Handle other requests
public invoke ( Imbo\EventManager\EventInterface $event )
$event Imbo\EventManager\EventInterface The event instance

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

Handle the OPTIONS requests
public options ( Imbo\EventManager\EventInterface $event )
$event Imbo\EventManager\EventInterface The event instance

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

Right before the response is sent to the client, whitelist all included Imbo-headers in the "Access-Control-Expose-Headers"-header
public setExposedHeaders ( Imbo\EventManager\EventInterface $event )
$event Imbo\EventManager\EventInterface The event instance

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

Subscribe to events based on configuration parameters
public subscribe ( Imbo\EventManager\EventInterface $event )
$event Imbo\EventManager\EventInterface The event instance