PHP Class Nord\Lumen\Cors\CorsService

Inheritance: implements Nord\Lumen\Cors\Contracts\CorsService
显示文件 Open project: nordsoftware/lumen-cors Class Usage Examples

Public Methods

Method Description
__construct ( array $config = [] ) CorsService constructor.
handlePreflightRequest ( Request $request )
handleRequest ( Request $request, Response $response )
isCorsRequest ( Request $request )
isPreflightRequest ( Request $request )

Protected Methods

Method Description
configure ( array $config ) Configures the service.
createErrorResponse ( string $content = '', integer $status = 400 ) : Illuminate\Http\Response Creates an error response.
createHeaderNotAllowedResponse ( Request $request )
createMethodNotAllowedResponse ( Request $request )
createOriginNotAllowedResponse ( Request $request )
createPreflightResponse ( Request $request ) : Response Creates a preflight response.
createResponse ( Request $request, Response $response ) : Response
isAllHeadersAllowed ( ) : boolean
isAllMethodsAllowed ( ) : boolean
isAllOriginsAllowed ( ) : boolean
isHeaderAllowed ( string $header ) : boolean Returns whether or not the header is allowed.
isMethodAllowed ( string $method ) : boolean Returns whether or not the method is allowed.
isOriginAllowed ( string $origin ) : boolean Returns whether or not the origin is allowed.
setAllowCredentials ( boolean $allowCredentials )
setAllowHeaders ( array $allowHeaders )
setAllowMethods ( array $allowMethods )
setAllowOrigins ( array $allowOrigins )
setExposeHeaders ( array $exposeHeaders )
setHeaderNotAllowed ( Callable $headerNotAllowed )
setMaxAge ( integer $maxAge )
setMethodNotAllowed ( Callable $methodNotAllowed )
setOriginNotAllowed ( Callable $originNotAllowed )
validatePreflightRequest ( Request $request )
validateRequest ( Request $request )

Method Details

__construct() public method

CorsService constructor.
public __construct ( array $config = [] )
$config array

configure() protected method

Configures the service.
protected configure ( array $config )
$config array

createErrorResponse() protected method

Creates an error response.
protected createErrorResponse ( string $content = '', integer $status = 400 ) : Illuminate\Http\Response
$content string
$status integer
return Illuminate\Http\Response

createHeaderNotAllowedResponse() protected method

protected createHeaderNotAllowedResponse ( Request $request )
$request Symfony\Component\HttpFoundation\Request

createMethodNotAllowedResponse() protected method

protected createMethodNotAllowedResponse ( Request $request )
$request Symfony\Component\HttpFoundation\Request

createOriginNotAllowedResponse() protected method

protected createOriginNotAllowedResponse ( Request $request )
$request Symfony\Component\HttpFoundation\Request

createPreflightResponse() protected method

Creates a preflight response.
protected createPreflightResponse ( Request $request ) : Response
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response

createResponse() protected method

protected createResponse ( Request $request, Response $response ) : Response
$request Symfony\Component\HttpFoundation\Request
$response Symfony\Component\HttpFoundation\Response
return Symfony\Component\HttpFoundation\Response

handlePreflightRequest() public method

public handlePreflightRequest ( Request $request )
$request Symfony\Component\HttpFoundation\Request

handleRequest() public method

public handleRequest ( Request $request, Response $response )
$request Symfony\Component\HttpFoundation\Request
$response Symfony\Component\HttpFoundation\Response

isAllHeadersAllowed() protected method

protected isAllHeadersAllowed ( ) : boolean
return boolean

isAllMethodsAllowed() protected method

protected isAllMethodsAllowed ( ) : boolean
return boolean

isAllOriginsAllowed() protected method

protected isAllOriginsAllowed ( ) : boolean
return boolean

isCorsRequest() public method

public isCorsRequest ( Request $request )
$request Symfony\Component\HttpFoundation\Request

isHeaderAllowed() protected method

Returns whether or not the header is allowed.
protected isHeaderAllowed ( string $header ) : boolean
$header string
return boolean

isMethodAllowed() protected method

Returns whether or not the method is allowed.
protected isMethodAllowed ( string $method ) : boolean
$method string
return boolean

isOriginAllowed() protected method

Returns whether or not the origin is allowed.
protected isOriginAllowed ( string $origin ) : boolean
$origin string
return boolean

isPreflightRequest() public method

public isPreflightRequest ( Request $request )
$request Symfony\Component\HttpFoundation\Request

setAllowCredentials() protected method

protected setAllowCredentials ( boolean $allowCredentials )
$allowCredentials boolean

setAllowHeaders() protected method

protected setAllowHeaders ( array $allowHeaders )
$allowHeaders array

setAllowMethods() protected method

protected setAllowMethods ( array $allowMethods )
$allowMethods array

setAllowOrigins() protected method

protected setAllowOrigins ( array $allowOrigins )
$allowOrigins array

setExposeHeaders() protected method

protected setExposeHeaders ( array $exposeHeaders )
$exposeHeaders array

setHeaderNotAllowed() protected method

protected setHeaderNotAllowed ( Callable $headerNotAllowed )
$headerNotAllowed Callable

setMaxAge() protected method

protected setMaxAge ( integer $maxAge )
$maxAge integer

setMethodNotAllowed() protected method

protected setMethodNotAllowed ( Callable $methodNotAllowed )
$methodNotAllowed Callable

setOriginNotAllowed() protected method

protected setOriginNotAllowed ( Callable $originNotAllowed )
$originNotAllowed Callable

validatePreflightRequest() protected method

protected validatePreflightRequest ( Request $request )
$request Symfony\Component\HttpFoundation\Request

validateRequest() protected method

protected validateRequest ( Request $request )
$request Symfony\Component\HttpFoundation\Request