PHP 클래스 Ham

파일 보기 프로젝트 열기: radiosilence/ham 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$cache
$config
$layout
$logger
$name
$parent
$prefix
$routes
$template_paths

공개 메소드들

메소드 설명
__construct ( string $name = 'default', mixed $cache = False, boolean $log = False ) Create a Ham application.
__invoke ( mixed | boolean $app = False ) : mixed | string Invoke method allows the application to be mounted as a closure.
_abort ( integer $code, string $message = '', Ham $app = null ) : string static version of abort to allow for calling of abort by class
abort ( integer $code, string $message = '' ) : string application specific Cancel method
config_from_env ( $var ) Allows configuration file to be specified by environment variable, to make deployment easy.
config_from_file ( $filename ) Configure an application object from a file.
create_cache ( $prefix, $dummy = False, $redisFirst = False ) Cache factory, be it XCache or APC.
create_logger ( $log_file ) Logger factory; just FileLogger for now.
json ( $obj, $code = 200 )
onError ( $closure_callback, $logMessage = NULL ) Exists only as a function to fill as a setter for A developer to add custom 404 pages If a log message is set, it will append the error functio to the developer-defined one.
partial ( $view, $data = null )
render ( $view, $data = null, $layout = null ) Returns the contents of a template, populated with the data given to it.
route ( $uri, $callback, array $request_methods = ['GET'] ) : boolean Add routes
run ( ) Calls route and outputs it to STDOUT

보호된 메소드들

메소드 설명
_compile_route ( $uri, $wildcard ) Takes a route in simple syntax and makes it into a regular expression.
_escape_route_uri ( $uri )
_find_route ( $path )
_get_compiled_routes ( )
_get_template_path ( $name )
_route ( $request_uri ) Makes sure the routes are compiled then scans through them and calls whichever one is approprate.
page_not_found ( ) Called upon when 404 is deduced to be the only outcome

메소드 상세

__construct() 공개 메소드

Create a Ham application.
public __construct ( string $name = 'default', mixed $cache = False, boolean $log = False )
$name string a canonical name for this app. Must not be shared between apps or cache collisions will happen. Unless you want that.
$cache mixed
$log boolean

__invoke() 공개 메소드

Invoke method allows the application to be mounted as a closure.
public __invoke ( mixed | boolean $app = False ) : mixed | string
$app mixed | boolean parent application that can be referenced by $app->parent
리턴 mixed | string

_abort() 공개 정적인 메소드

static version of abort to allow for calling of abort by class
public static _abort ( integer $code, string $message = '', Ham $app = null ) : string
$code integer
$message string
$app Ham
리턴 string

_compile_route() 보호된 메소드

Takes a route in simple syntax and makes it into a regular expression.
protected _compile_route ( $uri, $wildcard )

_escape_route_uri() 보호된 메소드

protected _escape_route_uri ( $uri )

_find_route() 보호된 메소드

protected _find_route ( $path )

_get_compiled_routes() 보호된 메소드

protected _get_compiled_routes ( )

_get_template_path() 보호된 메소드

protected _get_template_path ( $name )

_route() 보호된 메소드

Makes sure the routes are compiled then scans through them and calls whichever one is approprate.
protected _route ( $request_uri )

abort() 공개 메소드

application specific Cancel method
public abort ( integer $code, string $message = '' ) : string
$code integer
$message string
리턴 string

config_from_env() 공개 메소드

Allows configuration file to be specified by environment variable, to make deployment easy.
public config_from_env ( $var )

config_from_file() 공개 메소드

Configure an application object from a file.
public config_from_file ( $filename )

create_cache() 공개 정적인 메소드

Cache factory, be it XCache or APC.
public static create_cache ( $prefix, $dummy = False, $redisFirst = False )

create_logger() 공개 정적인 메소드

Logger factory; just FileLogger for now.
public static create_logger ( $log_file )

json() 공개 메소드

public json ( $obj, $code = 200 )

onError() 공개 메소드

Exists only as a function to fill as a setter for A developer to add custom 404 pages If a log message is set, it will append the error functio to the developer-defined one.
public onError ( $closure_callback, $logMessage = NULL )

page_not_found() 보호된 메소드

Called upon when 404 is deduced to be the only outcome
protected page_not_found ( )

partial() 공개 메소드

public partial ( $view, $data = null )

render() 공개 메소드

Returns the contents of a template, populated with the data given to it.
public render ( $view, $data = null, $layout = null )

route() 공개 메소드

Add routes
public route ( $uri, $callback, array $request_methods = ['GET'] ) : boolean
$uri
$callback
$request_methods array
리턴 boolean

run() 공개 메소드

Calls route and outputs it to STDOUT
public run ( )

프로퍼티 상세

$cache 공개적으로 프로퍼티

public $cache

$config 공개적으로 프로퍼티

public $config

$layout 공개적으로 프로퍼티

public $layout

$logger 공개적으로 프로퍼티

public $logger

$name 공개적으로 프로퍼티

public $name

$parent 공개적으로 프로퍼티

public $parent

$prefix 공개적으로 프로퍼티

public $prefix

$routes 공개적으로 프로퍼티

public $routes

$template_paths 공개적으로 프로퍼티

public $template_paths