PHP Класс Cascade\Config\Loader\ClassLoader\Resolver\ConstructorResolver

Автор: Raphael Antonmattei ([email protected])
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$constructorArgs ReflectionParameter[] Associative array of contructor args to resolve against
$reflected ReflectionClass Reflection class for which you want to resolve constructor options

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

Метод Описание
__construct ( ReflectionClass $reflected ) Contructor
getConstructorArgs ( ) : array Returns the contructor args as an associative array
getReflected ( ) : ReflectionClass Returns the reflected object
hashToArgsArray ( array $hashOfOptions ) : array Loops through constructor args and buid an ordered array of args using the option values passed in. We assume the passed in array has been resolved already.
initConstructorArgs ( ) Fetches constructor args (array of ReflectionParameter) from the reflected class and set them as an associative array
resolve ( array $options ) : array Resolve options against constructor args

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

Метод Описание
configureOptions ( Symfony\Component\OptionsResolver\OptionsResolver $optionsResolver ) Configure options for the provided OptionResolver to match contructor args requirements

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

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

Contructor
public __construct ( ReflectionClass $reflected )
$reflected ReflectionClass Reflection class for which you want to resolve constructor options

configureOptions() защищенный Метод

Configure options for the provided OptionResolver to match contructor args requirements
protected configureOptions ( Symfony\Component\OptionsResolver\OptionsResolver $optionsResolver )
$optionsResolver Symfony\Component\OptionsResolver\OptionsResolver OptionResolver to configure

getConstructorArgs() публичный Метод

Returns the contructor args as an associative array
public getConstructorArgs ( ) : array
Результат array Contructor args

getReflected() публичный Метод

Returns the reflected object
public getReflected ( ) : ReflectionClass
Результат ReflectionClass

hashToArgsArray() публичный Метод

i.e. That the arg name has an entry in the option array.
public hashToArgsArray ( array $hashOfOptions ) : array
$hashOfOptions array Array of options
Результат array Array of ordered args

initConstructorArgs() публичный Метод

Convert the parameter names to camelCase for classes that have contructor params defined in snake_case for consistency with the options
public initConstructorArgs ( )

resolve() публичный Метод

Resolve options against constructor args
public resolve ( array $options ) : array
$options array Array of option values. Expected array looks like: array( 'someParam' => 'def', 'someOtherParam' => 'sdsad' )
Результат array Array of resolved ordered args

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

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

Associative array of contructor args to resolve against
protected ReflectionParameter[] $constructorArgs
Результат ReflectionParameter[]

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

Reflection class for which you want to resolve constructor options
protected ReflectionClass $reflected
Результат ReflectionClass