PHP Class Lime\App

Inheritance: implements ArrayAccess
Afficher le fichier Open project: aheinze/lime Class Usage Examples

Méthodes publiques

Свойство Type Description
$helpers
$layout
$mimeTypes * mime types
$response Response | null
$statusCodes * status codes
$viewvars * global view variables

Protected Properties

Свойство Type Description
$apps
$blocks
$events
$exit
$paths
$registry
$routes

Méthodes publiques

Méthode Description
__construct ( Array $settings = [] ) Constructor
__get ( $name ) accces to services
__invoke ( $helper ) Invoke call
assets ( $src, $version = false )
base ( $path )
baseUrl ( String $path ) : String Returns link based on the base url of the app
bind ( String $path, Closure $callback, boolean $condition = true ) : void Bind request to route
bindClass ( String $class, $alias = false ) : void Bind Class to routes
bindNamespace ( String $namespace, $alias ) : void Bind namespace to routes
block ( String $name, array $options = [] ) : String Get block content
cache ( ) : Mixed Cache helper method
decode ( [type] $data, [type] $pwd ) : [type] Decode RC4 encrypted text
dispatch ( String $path ) : Mixed Dispatch route
encode ( [type] $data, [type] $pwd, boolean $base64encoded = false ) : [type] RC4 encryption
end ( String $name ) : Null End block
escape ( String $string, String $charset = null ) : String Escape string.
get ( String $path, Closure $callback, boolean $condition = true ) : void Bind GET request to route
getClientIp ( ) : String Get client ip.
getClientLang ( $default = "en" ) : String Get client language
getSiteUrl ( $withpath = false ) : String Get site url
hash ( $text, $algo = PASSWORD_BCRYPT ) : String Create Hash
helper ( $helper )
instance ( String $name ) : Object Get App instance
invoke ( String $class, String $action = "index", Array $params = [] ) : Mixed Invoke Class as controller
isAbsolutePath ( $path )
isExit ( ) : boolean Is application stopped?
loadModules ( $dirs, $autoload = true, $prefix = false )
module ( $name )
offsetExists ( $key )
offsetGet ( $key )
offsetSet ( $key, $value ) Array Access implementation
offsetUnset ( $key )
on ( String $event, Closure $callback, integer $priority ) : void Bind an event to closure
param ( String $index = null, Mixed $default = null, Array $source = null ) : Mixed Get request variables
path ( ) : Mixed Path helper method
pathToUrl ( $path ) : boolean | string
post ( String $path, Closure $callback, boolean $condition = true ) : void Bind POST request to route
registerModule ( $name, $dir )
render ( String $____template, Array $_____slots = [] ) : String Render view.
req_is ( String $type ) : boolean Request helper function
reroute ( String $path ) : void Redirect to path.
retrieve ( String $key, Mixed $default = null ) : Mixed Get a value from the Lime registry
route ( )
routeUrl ( String $path ) : String Returns link based on the route url of the app
run ( String $route = null ) : void Run Application
script ( String $src, $version = false ) : String Get script inc. markup
service ( String $name, Closure $callable ) : Object Returns a closure that stores the result of the given closure
set ( String $key, Mixed $value ) Put a value in the Lime registry
start ( String $name ) : Null Start block
stop ( $data = false ) stop application (exit)
style ( String $href, $version = false ) : String Get style inc. markup
trigger ( String $event, Array $params = [] ) : boolean Trigger event.

Méthodes protégées

Méthode Description
bootModule ( $module )
render_route ( [type] $route, array $params = [] ) : String Render dispatched route

Method Details

__construct() public méthode

Constructor
public __construct ( Array $settings = [] )
$settings Array initial registry settings

__get() public méthode

accces to services
public __get ( $name )

__invoke() public méthode

Invoke call
public __invoke ( $helper )

assets() public méthode

public assets ( $src, $version = false )

base() public méthode

public base ( $path )

baseUrl() public méthode

Returns link based on the base url of the app
public baseUrl ( String $path ) : String
$path String e.g. /js/myscript.js
Résultat String Link

bind() public méthode

Bind request to route
public bind ( String $path, Closure $callback, boolean $condition = true ) : void
$path String
$callback Closure
$condition boolean
Résultat void

bindClass() public méthode

Bind Class to routes
public bindClass ( String $class, $alias = false ) : void
$class String
Résultat void

bindNamespace() public méthode

Bind namespace to routes
public bindNamespace ( String $namespace, $alias ) : void
$namespace String
Résultat void

block() public méthode

Get block content
public block ( String $name, array $options = [] ) : String
$name String
$options array
Résultat String

bootModule() protected méthode

protected bootModule ( $module )

cache() public méthode

Cache helper method
public cache ( ) : Mixed
Résultat Mixed

decode() public méthode

Decode RC4 encrypted text
public decode ( [type] $data, [type] $pwd ) : [type]
$data [type]
$pwd [type]
Résultat [type]

dispatch() public méthode

Dispatch route
public dispatch ( String $path ) : Mixed
$path String
Résultat Mixed

encode() public méthode

RC4 encryption
public encode ( [type] $data, [type] $pwd, boolean $base64encoded = false ) : [type]
$data [type]
$pwd [type]
$base64encoded boolean [description]
Résultat [type]

end() public méthode

End block
public end ( String $name ) : Null
$name String
Résultat Null

escape() public méthode

Escape string.
public escape ( String $string, String $charset = null ) : String
$string String
$charset String
Résultat String

get() public méthode

Bind GET request to route
public get ( String $path, Closure $callback, boolean $condition = true ) : void
$path String
$callback Closure
$condition boolean
Résultat void

getClientIp() public méthode

Get client ip.
public getClientIp ( ) : String
Résultat String

getClientLang() public méthode

Get client language
public getClientLang ( $default = "en" ) : String
Résultat String

getSiteUrl() public méthode

Get site url
public getSiteUrl ( $withpath = false ) : String
Résultat String

hash() public méthode

Create Hash
public hash ( $text, $algo = PASSWORD_BCRYPT ) : String
Résultat String

helper() public méthode

public helper ( $helper )

instance() public static méthode

Get App instance
public static instance ( String $name ) : Object
$name String Lime app name
Résultat Object Lime app object

invoke() public méthode

Invoke Class as controller
public invoke ( String $class, String $action = "index", Array $params = [] ) : Mixed
$class String
$action String
$params Array
Résultat Mixed

isAbsolutePath() public méthode

public isAbsolutePath ( $path )

isExit() public méthode

Is application stopped?
public isExit ( ) : boolean
Résultat boolean

loadModules() public méthode

public loadModules ( $dirs, $autoload = true, $prefix = false )

module() public méthode

public module ( $name )

offsetExists() public méthode

public offsetExists ( $key )

offsetGet() public méthode

public offsetGet ( $key )

offsetSet() public méthode

Array Access implementation
public offsetSet ( $key, $value )

offsetUnset() public méthode

public offsetUnset ( $key )

on() public méthode

Bind an event to closure
public on ( String $event, Closure $callback, integer $priority ) : void
$event String
$callback Closure
$priority integer
Résultat void

param() public méthode

Get request variables
public param ( String $index = null, Mixed $default = null, Array $source = null ) : Mixed
$index String
$default Mixed
$source Array
Résultat Mixed

path() public méthode

Path helper method
public path ( ) : Mixed
Résultat Mixed

pathToUrl() public méthode

public pathToUrl ( $path ) : boolean | string
$path
Résultat boolean | string

post() public méthode

Bind POST request to route
public post ( String $path, Closure $callback, boolean $condition = true ) : void
$path String
$callback Closure
$condition boolean
Résultat void

registerModule() public méthode

public registerModule ( $name, $dir )

render() public méthode

Render view.
public render ( String $____template, Array $_____slots = [] ) : String
$____template String Path to view
$_____slots Array Passed variables
Résultat String Rendered view

render_route() protected méthode

Render dispatched route
protected render_route ( [type] $route, array $params = [] ) : String
$route [type]
$params array
Résultat String

req_is() public méthode

Request helper function
public req_is ( String $type ) : boolean
$type String
Résultat boolean

reroute() public méthode

Redirect to path.
public reroute ( String $path ) : void
$path String Path redirect to.
Résultat void

retrieve() public méthode

Get a value from the Lime registry
public retrieve ( String $key, Mixed $default = null ) : Mixed
$key String
$default Mixed
Résultat Mixed

route() public méthode

public route ( )

routeUrl() public méthode

Returns link based on the route url of the app
public routeUrl ( String $path ) : String
$path String e.g. /pages/home
Résultat String Link

run() public méthode

Run Application
public run ( String $route = null ) : void
$route String Route to parse
Résultat void

script() public méthode

Get script inc. markup
public script ( String $src, $version = false ) : String
$src String
Résultat String

service() public méthode

Returns a closure that stores the result of the given closure
public service ( String $name, Closure $callable ) : Object
$name String
$callable Closure
Résultat Object

set() public méthode

Put a value in the Lime registry
public set ( String $key, Mixed $value )
$key String Key name
$value Mixed Value

start() public méthode

Start block
public start ( String $name ) : Null
$name String
Résultat Null

stop() public méthode

stop application (exit)
public stop ( $data = false )

style() public méthode

Get style inc. markup
public style ( String $href, $version = false ) : String
$href String
Résultat String

trigger() public méthode

Trigger event.
public trigger ( String $event, Array $params = [] ) : boolean
$event String
$params Array
Résultat boolean

Property Details

$apps protected_oe static_oe property

protected static $apps

$blocks protected_oe property

protected $blocks

$events protected_oe property

protected $events

$exit protected_oe property

protected $exit

$helpers public_oe property

public $helpers

$layout public_oe property

public $layout

$mimeTypes public_oe static_oe property

* mime types
public static $mimeTypes

$paths protected_oe property

protected $paths

$registry protected_oe property

protected $registry

$response public_oe property

public Response,lime|null $response
Résultat Response | null

$routes protected_oe property

protected $routes

$statusCodes public_oe static_oe property

* status codes
public static $statusCodes

$viewvars public_oe property

* global view variables
public $viewvars