PHP Class Cascade\Config\Loader\ClassLoader

Some of them are applicable to the constructor, other are applicable to other handlers. For the latter you need to make sure there is a handler defined for that option
Author: Raphael Antonmattei ([email protected])
Author: Dom Morgan ([email protected])
Datei anzeigen Open project: theorchard/monolog-cascade Class Usage Examples

Public Properties

Property Type Description
$class String Name of the class you want to load
$extraOptionHandlers array array( '\Full\Absolute\Namespace\ClassName' => array( 'myOption' => Closure ), ... )

Protected Properties

Property Type Description
$rawOptions array Array of options. This is a raw copy of the options passed in.
$reflected ReflectionClass Reflected object of the class passed in

Public Methods

Method Description
__construct ( array $options ) Constructor
canHandle ( string $extraOptionName ) : boolean Indicates whether or not an option is supported by the loader
getExtraOptionsHandler ( string $extraOptionName ) : Closure | null Get the corresponding handler for a given option
load ( ) : mixed Instantiate the reflected object using the parsed contructor args and set extra options if any
loadExtraOptions ( array $extraOptions, mixed $instance ) Set extra options if any were requested
optionsToCamelCase ( array $options ) : mixed[] Return option values indexed by name using camelCased keys

Protected Methods

Method Description
loadChildClasses ( ) Recursively loads objects into any of the rawOptions that represent a class
setClass ( ) Set the class you want to load from the raw option array

Private Methods

Method Description
resolveOptions ( ) : array Resolve options and returns them into 2 buckets: - constructor options and - extra options Extra options are those that are not in the contructor. The constructor arguments determine what goes into which bucket

Method Details

__construct() public method

Constructor
public __construct ( array $options )
$options array Array of options The option array might look like: array( 'class' => 'Some\Class', 'some_contruct_param' => 'abc', 'some_param' => 'def', 'some_other_param' => 'sdsad' )

canHandle() public method

Indicates whether or not an option is supported by the loader
public canHandle ( string $extraOptionName ) : boolean
$extraOptionName string Option name
return boolean Whether or not an option is supported by the loader

getExtraOptionsHandler() public method

Get the corresponding handler for a given option
public getExtraOptionsHandler ( string $extraOptionName ) : Closure | null
$extraOptionName string Option name
return Closure | null Corresponding Closure object or null if not found

load() public method

Instantiate the reflected object using the parsed contructor args and set extra options if any
public load ( ) : mixed
return mixed Instance of the reflected object

loadChildClasses() protected method

Recursively loads objects into any of the rawOptions that represent a class
protected loadChildClasses ( )

loadExtraOptions() public method

Set extra options if any were requested
public loadExtraOptions ( array $extraOptions, mixed $instance )
$extraOptions array Array of extra options (key => value)
$instance mixed Instance you want to set options for

optionsToCamelCase() public static method

Return option values indexed by name using camelCased keys
public static optionsToCamelCase ( array $options ) : mixed[]
$options array Array of options
return mixed[] Array of options indexed by (camelCased) name

setClass() protected method

Set the class you want to load from the raw option array
protected setClass ( )

Property Details

$class public_oe property

Name of the class you want to load
public String $class
return String

$extraOptionHandlers public_oe static_oe property

array( '\Full\Absolute\Namespace\ClassName' => array( 'myOption' => Closure ), ... )
public static array $extraOptionHandlers
return array

$rawOptions protected_oe property

Array of options. This is a raw copy of the options passed in.
protected array $rawOptions
return array

$reflected protected_oe property

Reflected object of the class passed in
protected ReflectionClass $reflected
return ReflectionClass