PHP 클래스 Scalr\Api\Rest\Application

부터: 5.4.0 (09.02.2015)
저자: Vitaliy Demidov ([email protected])
파일 보기 프로젝트 열기: scalr/scalr 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$startTime float API Application start time

보호된 프로퍼티들

프로퍼티 타입 설명
$pathPreprocessor callable Preprocess request method and path

공개 메소드들

메소드 설명
__construct ( array $settings = [] ) Constructor
__get ( $name )
__isset ( $name )
addRoute ( string $path, array | callable $options, array $requirements = [] ) : Scalr\Api\Rest\Routing\Route Adds a route to routing table
call ( ) Application wide handler
delete ( string $path, array | callable $options, array $requirements = [] ) : Scalr\Api\Rest\Routing\Route Adds delete route
error ( Callable | Exception $e = null ) Error handler
get ( string $path, array | callable $options, array $requirements = [] ) : Scalr\Api\Rest\Routing\Route Adds get route
getContainer ( ) : Container Gets API Container
getDefaultSettings ( )
getRouteUrl ( string $route, array $params = [] ) : string Gets url for the specified route
group ( ) Route Groups
halt ( number $status, string $message = '' ) Stops application immediately
handleApiVersion ( Scalr\Api\Rest\Routing\Route $route ) ApiVersion middleware handler
handleErrors ( integer $errno, string $errstr, string $errfile, integer $errline ) : boolean Error handler
notFound ( ) Not found handler
options ( string $path, array | callable $options, array $requirements = [] ) : Scalr\Api\Rest\Routing\Route Adds options route
patch ( string $path, array | callable $options, array $requirements = [] ) : Scalr\Api\Rest\Routing\Route Adds patch route
post ( string $path, array | callable $options, array $requirements = [] ) : Scalr\Api\Rest\Routing\Route Adds post route
put ( string $path, array | callable $options, array $requirements = [] ) : Scalr\Api\Rest\Routing\Route Adds put route
redirect ( string $url, number $status = 302 ) Redirects to the specified url
redirectTo ( string $route, array $params = [], number $status = 302 ) Redirects to the specified named route
run ( ) Runs application
stop ( ) Stops application

보호된 메소드들

메소드 설명
callErrorHandler ( Exception $e = null ) : string Calls error handler
defaultError ( ErrorException $e = null ) : string Gets default error content
getDefaultTemplate ( string $title, string $body ) : string Parses default template and returns its content

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( array $settings = [] )
$settings array optional Application settings

__get() 공개 메소드

public __get ( $name )

__isset() 공개 메소드

public __isset ( $name )

addRoute() 공개 메소드

Adds a route to routing table
public addRoute ( string $path, array | callable $options, array $requirements = [] ) : Scalr\Api\Rest\Routing\Route
$path string The path pattern of the route
$options array | callable The options
$requirements array optional The requirements
리턴 Scalr\Api\Rest\Routing\Route Returns route instance

call() 공개 메소드

Application wide handler
public call ( )

callErrorHandler() 보호된 메소드

Calls error handler
protected callErrorHandler ( Exception $e = null ) : string
$e Exception optional An exception
리턴 string

defaultError() 보호된 메소드

Gets default error content
protected defaultError ( ErrorException $e = null ) : string
$e ErrorException optional An Exception
리턴 string

delete() 공개 메소드

Adds delete route
public delete ( string $path, array | callable $options, array $requirements = [] ) : Scalr\Api\Rest\Routing\Route
$path string The path pattern of the route
$options array | callable The options
$requirements array optional The requirements
리턴 Scalr\Api\Rest\Routing\Route Returns route instance

error() 공개 메소드

It registers error handler or invokes registered error handler with an exception
public error ( Callable | Exception $e = null )
$e Callable | Exception optional Either the callable handler or exception

get() 공개 메소드

Adds get route
public get ( string $path, array | callable $options, array $requirements = [] ) : Scalr\Api\Rest\Routing\Route
$path string The path pattern of the route
$options array | callable The options
$requirements array optional The requirements
리턴 Scalr\Api\Rest\Routing\Route Returns route instance

getContainer() 공개 메소드

Gets API Container
public getContainer ( ) : Container
리턴 Scalr\DependencyInjection\Container Returns DI Container instance

getDefaultSettings() 공개 정적인 메소드

public static getDefaultSettings ( )

getDefaultTemplate() 보호된 메소드

Parses default template and returns its content
protected getDefaultTemplate ( string $title, string $body ) : string
$title string A title
$body string A body
리턴 string Returns parsed template

getRouteUrl() 공개 메소드

Gets url for the specified route
public getRouteUrl ( string $route, array $params = [] ) : string
$route string The name of the route
$params array optional The parameters
리턴 string Returns the URL for the specified Route

group() 공개 메소드

Route Groups
public group ( )

halt() 공개 메소드

Stops application immediately
public halt ( number $status, string $message = '' )
$status number HTTP response status code
$message string optional The response message

handleApiVersion() 공개 메소드

It extracts :apiversion group parameter from the route and sets application setting
public handleApiVersion ( Scalr\Api\Rest\Routing\Route $route )
$route Scalr\Api\Rest\Routing\Route A route

handleErrors() 공개 정적인 메소드

Error handler
public static handleErrors ( integer $errno, string $errstr, string $errfile, integer $errline ) : boolean
$errno integer
$errstr string
$errfile string
$errline integer
리턴 boolean

notFound() 공개 메소드

Not found handler
public notFound ( )

options() 공개 메소드

Adds options route
public options ( string $path, array | callable $options, array $requirements = [] ) : Scalr\Api\Rest\Routing\Route
$path string The path pattern of the route
$options array | callable The options
$requirements array optional The requirements
리턴 Scalr\Api\Rest\Routing\Route Returns route instance

patch() 공개 메소드

Adds patch route
public patch ( string $path, array | callable $options, array $requirements = [] ) : Scalr\Api\Rest\Routing\Route
$path string The path pattern of the route
$options array | callable The options
$requirements array optional The requirements
리턴 Scalr\Api\Rest\Routing\Route Returns route instance

post() 공개 메소드

Adds post route
public post ( string $path, array | callable $options, array $requirements = [] ) : Scalr\Api\Rest\Routing\Route
$path string The path pattern of the route
$options array | callable The options
$requirements array optional The requirements
리턴 Scalr\Api\Rest\Routing\Route Returns route instance

put() 공개 메소드

Adds put route
public put ( string $path, array | callable $options, array $requirements = [] ) : Scalr\Api\Rest\Routing\Route
$path string The path pattern of the route
$options array | callable The options
$requirements array optional The requirements
리턴 Scalr\Api\Rest\Routing\Route Returns route instance

redirect() 공개 메소드

Redirects to the specified url
public redirect ( string $url, number $status = 302 )
$url string The URL
$status number optional The HTTP response status code

redirectTo() 공개 메소드

Redirects to the specified named route
public redirectTo ( string $route, array $params = [], number $status = 302 )
$route string The name of the Route
$params array optional The list of the parameters
$status number optional The HTTP response status code.

run() 공개 메소드

Runs application
public run ( )

stop() 공개 메소드

Stops application
public stop ( )

프로퍼티 상세

$pathPreprocessor 보호되어 있는 프로퍼티

Preprocess request method and path
protected callable $pathPreprocessor
리턴 callable

$startTime 공개적으로 프로퍼티

API Application start time
public float $startTime
리턴 float