PHP Class Airship\Engine\Gears

The gears class contains a bunch of methods for the plugin system (Airship Gears)
Show file Open project: paragonie/airship Class Usage Examples

Public Methods

Method Description
attach ( string $index, string $new_type, string $namespace = '' ) : boolean Attach a plugin to overload the base class
extract ( string $index, string $desired_name, string $namespace = '' ) : string Create a shim that extends a gear type
forge ( string $index, string $type ) : boolean Add a new type to the Gears registry
get ( string $name, variadic $args ) : mixed Get an instance of a gear (all arguments after the first are passed to its constructor)
getName ( string $name ) : string Get the class name of a Gear
init ( array $gears = [] ) Set up initial classes
lazyForge ( string $index, string $type ) : boolean Add a new type to the Gears registry

Protected Methods

Method Description
coreEval ( string $code, boolean $cache = false, boolean $do_not_eval = false ) : mixed Execute a block of code.
sandboxRequire ( string $file ) : boolean Load a file in a way that doesn't allow access to the parent method's internal functions

Method Details

attach() public static method

Attach a plugin to overload the base class
public static attach ( string $index, string $new_type, string $namespace = '' ) : boolean
$index string Index
$new_type string New type
$namespace string Namespace
return boolean

coreEval() protected static method

Execute a block of code.
protected static coreEval ( string $code, boolean $cache = false, boolean $do_not_eval = false ) : mixed
$code string
$cache boolean
$do_not_eval boolean
return mixed

extract() public static method

Create a shim that extends a gear type
public static extract ( string $index, string $desired_name, string $namespace = '' ) : string
$index string
$desired_name string
$namespace string Namespace
return string

forge() public static method

Add a new type to the Gears registry
public static forge ( string $index, string $type ) : boolean
$index string
$type string
return boolean

get() public static method

Get an instance of a gear (all arguments after the first are passed to its constructor)
public static get ( string $name, variadic $args ) : mixed
$name string - Gear identifier
$args variadic - constructor parameters
return mixed

getName() public static method

Get the class name of a Gear
public static getName ( string $name ) : string
$name string
return string

init() public static method

Set up initial classes
public static init ( array $gears = [] )
$gears array

lazyForge() public static method

Add a new type to the Gears registry
public static lazyForge ( string $index, string $type ) : boolean
$index string
$type string
return boolean

sandboxRequire() protected method

Load a file in a way that doesn't allow access to the parent method's internal functions
protected sandboxRequire ( string $file ) : boolean
$file string
return boolean