PHP Класс 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
Автор: Raphael Antonmattei ([email protected])
Автор: Dom Morgan ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$class String Name of the class you want to load
$extraOptionHandlers array array( '\Full\Absolute\Namespace\ClassName' => array( 'myOption' => Closure ), ... )

Защищенные свойства (Protected)

Свойство Тип Описание
$rawOptions array Array of options. This is a raw copy of the options passed in.
$reflected ReflectionClass Reflected object of the class passed in

Открытые методы

Метод Описание
__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

Защищенные методы

Метод Описание
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

Приватные методы

Метод Описание
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

Описание методов

__construct() публичный метод

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() публичный метод

Indicates whether or not an option is supported by the loader
public canHandle ( string $extraOptionName ) : boolean
$extraOptionName string Option name
Результат boolean Whether or not an option is supported by the loader

getExtraOptionsHandler() публичный метод

Get the corresponding handler for a given option
public getExtraOptionsHandler ( string $extraOptionName ) : Closure | null
$extraOptionName string Option name
Результат Closure | null Corresponding Closure object or null if not found

load() публичный метод

Instantiate the reflected object using the parsed contructor args and set extra options if any
public load ( ) : mixed
Результат mixed Instance of the reflected object

loadChildClasses() защищенный метод

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

loadExtraOptions() публичный метод

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() публичный статический метод

Return option values indexed by name using camelCased keys
public static optionsToCamelCase ( array $options ) : mixed[]
$options array Array of options
Результат mixed[] Array of options indexed by (camelCased) name

setClass() защищенный метод

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

Описание свойств

$class публичное свойство

Name of the class you want to load
public String $class
Результат String

$extraOptionHandlers публичное статическое свойство

array( '\Full\Absolute\Namespace\ClassName' => array( 'myOption' => Closure ), ... )
public static array $extraOptionHandlers
Результат array

$rawOptions защищенное свойство

Array of options. This is a raw copy of the options passed in.
protected array $rawOptions
Результат array

$reflected защищенное свойство

Reflected object of the class passed in
protected ReflectionClass $reflected
Результат ReflectionClass