PHP 클래스 flight\Engine

It is responsible for loading an HTTP request, running the assigned services, and generating an HTTP response.
파일 보기 프로젝트 열기: mikecao/flight 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$dispatcher object Event dispatcher.
$loader object Class loader.
$vars array Stored variables.

공개 메소드들

메소드 설명
__call ( string $name, array $params ) : mixed Handles calls to class methods.
__construct ( ) Constructor.
_error ( object $e ) Sends an HTTP 500 response for any errors.
_etag ( string $id, string $type = 'strong' ) Handles ETag HTTP caching.
_halt ( integer $code = 200, string $message = '' ) Stops processing and returns a given response.
_json ( mixed $data, integer $code = 200, boolean $encode = true, string $charset = 'utf-8', integer $option ) Sends a JSON response.
_jsonp ( mixed $data, string $param = 'jsonp', integer $code = 200, boolean $encode = true, string $charset = 'utf-8', integer $option ) Sends a JSONP response.
_lastModified ( integer $time ) Handles last modified HTTP caching.
_notFound ( ) Sends an HTTP 404 response when a URL is not found.
_redirect ( string $url, integer $code = 303 ) Redirects the current request to another URL.
_render ( string $file, array $data = null, string $key = null ) Renders a template.
_route ( string $pattern, callback $callback, boolean $pass_route = false ) Routes a URL to a callback function.
_start ( ) Starts the framework.
_stop ( integer $code = 200 ) Stops the framework and outputs the current response.
after ( string $name, callback $callback ) Adds a post-filter to a method.
before ( string $name, callback $callback ) Adds a pre-filter to a method.
clear ( string $key = null ) Unsets a variable. If no key is passed in, clear all variables.
get ( string $key = null ) : mixed Gets a variable.
handleError ( integer $errno, integer $errstr, integer $errfile, integer $errline ) Custom error handler. Converts errors into exceptions.
handleErrors ( boolean $enabled ) Enables/disables custom error handling.
handleException ( object $e ) Custom exception handler. Logs exceptions.
has ( string $key ) : boolean Checks if a variable has been set.
init ( ) Initializes the framework.
map ( string $name, callback $callback ) Maps a callback to a framework method.
path ( string $dir ) Adds a path for class autoloading.
register ( string $name, string $class, array $params = [], callback $callback = null ) Registers a class to a framework method.
set ( mixed $key, string $value = null ) Sets a variable.

메소드 상세

__call() 공개 메소드

Handles calls to class methods.
public __call ( string $name, array $params ) : mixed
$name string Method name
$params array Method parameters
리턴 mixed Callback results

__construct() 공개 메소드

Constructor.
public __construct ( )

_error() 공개 메소드

Sends an HTTP 500 response for any errors.
public _error ( object $e )
$e object Thrown exception

_etag() 공개 메소드

Handles ETag HTTP caching.
public _etag ( string $id, string $type = 'strong' )
$id string ETag identifier
$type string ETag type

_halt() 공개 메소드

Stops processing and returns a given response.
public _halt ( integer $code = 200, string $message = '' )
$code integer HTTP status code
$message string Response message

_json() 공개 메소드

Sends a JSON response.
public _json ( mixed $data, integer $code = 200, boolean $encode = true, string $charset = 'utf-8', integer $option )
$data mixed JSON data
$code integer HTTP status code
$encode boolean Whether to perform JSON encoding
$charset string Charset
$option integer Bitmask Json constant such as JSON_HEX_QUOT

_jsonp() 공개 메소드

Sends a JSONP response.
public _jsonp ( mixed $data, string $param = 'jsonp', integer $code = 200, boolean $encode = true, string $charset = 'utf-8', integer $option )
$data mixed JSON data
$param string Query parameter that specifies the callback name.
$code integer HTTP status code
$encode boolean Whether to perform JSON encoding
$charset string Charset
$option integer Bitmask Json constant such as JSON_HEX_QUOT

_lastModified() 공개 메소드

Handles last modified HTTP caching.
public _lastModified ( integer $time )
$time integer Unix timestamp

_notFound() 공개 메소드

Sends an HTTP 404 response when a URL is not found.
public _notFound ( )

_redirect() 공개 메소드

Redirects the current request to another URL.
public _redirect ( string $url, integer $code = 303 )
$url string URL
$code integer HTTP status code

_render() 공개 메소드

Renders a template.
public _render ( string $file, array $data = null, string $key = null )
$file string Template file
$data array Template data
$key string View variable name

_route() 공개 메소드

Routes a URL to a callback function.
public _route ( string $pattern, callback $callback, boolean $pass_route = false )
$pattern string URL pattern to match
$callback callback Callback function
$pass_route boolean Pass the matching route object to the callback

_start() 공개 메소드

Starts the framework.
public _start ( )

_stop() 공개 메소드

Stops the framework and outputs the current response.
public _stop ( integer $code = 200 )
$code integer HTTP status code

after() 공개 메소드

Adds a post-filter to a method.
public after ( string $name, callback $callback )
$name string Method name
$callback callback Callback function

before() 공개 메소드

Adds a pre-filter to a method.
public before ( string $name, callback $callback )
$name string Method name
$callback callback Callback function

clear() 공개 메소드

Unsets a variable. If no key is passed in, clear all variables.
public clear ( string $key = null )
$key string Key

get() 공개 메소드

Gets a variable.
public get ( string $key = null ) : mixed
$key string Key
리턴 mixed

handleError() 공개 메소드

Custom error handler. Converts errors into exceptions.
public handleError ( integer $errno, integer $errstr, integer $errfile, integer $errline )
$errno integer Error number
$errstr integer Error string
$errfile integer Error file name
$errline integer Error file line number

handleErrors() 공개 메소드

Enables/disables custom error handling.
public handleErrors ( boolean $enabled )
$enabled boolean True or false

handleException() 공개 메소드

Custom exception handler. Logs exceptions.
public handleException ( object $e )
$e object Thrown exception

has() 공개 메소드

Checks if a variable has been set.
public has ( string $key ) : boolean
$key string Key
리턴 boolean Variable status

init() 공개 메소드

Initializes the framework.
public init ( )

map() 공개 메소드

Maps a callback to a framework method.
public map ( string $name, callback $callback )
$name string Method name
$callback callback Callback function

path() 공개 메소드

Adds a path for class autoloading.
public path ( string $dir )
$dir string Directory path

register() 공개 메소드

Registers a class to a framework method.
public register ( string $name, string $class, array $params = [], callback $callback = null )
$name string Method name
$class string Class name
$params array Class initialization parameters
$callback callback Function to call after object instantiation

set() 공개 메소드

Sets a variable.
public set ( mixed $key, string $value = null )
$key mixed Key
$value string Value

프로퍼티 상세

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

Event dispatcher.
protected object $dispatcher
리턴 object

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

Class loader.
protected object $loader
리턴 object

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

Stored variables.
protected array $vars
리턴 array