PHP Class Cascade\Config\Loader\ClassLoader\Resolver\ConstructorResolver

Author: Raphael Antonmattei ([email protected])
Afficher le fichier Open project: theorchard/monolog-cascade Class Usage Examples

Protected Properties

Свойство Type Description
$constructorArgs ReflectionParameter[] Associative array of contructor args to resolve against
$reflected ReflectionClass Reflection class for which you want to resolve constructor options

Méthodes publiques

Méthode Description
__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

Méthodes protégées

Méthode Description
configureOptions ( Symfony\Component\OptionsResolver\OptionsResolver $optionsResolver ) Configure options for the provided OptionResolver to match contructor args requirements

Method Details

__construct() public méthode

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

configureOptions() protected méthode

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() public méthode

Returns the contructor args as an associative array
public getConstructorArgs ( ) : array
Résultat array Contructor args

getReflected() public méthode

Returns the reflected object
public getReflected ( ) : ReflectionClass
Résultat ReflectionClass

hashToArgsArray() public méthode

i.e. That the arg name has an entry in the option array.
public hashToArgsArray ( array $hashOfOptions ) : array
$hashOfOptions array Array of options
Résultat array Array of ordered args

initConstructorArgs() public méthode

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

resolve() public méthode

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' )
Résultat array Array of resolved ordered args

Property Details

$constructorArgs protected_oe property

Associative array of contructor args to resolve against
protected ReflectionParameter[] $constructorArgs
Résultat ReflectionParameter[]

$reflected protected_oe property

Reflection class for which you want to resolve constructor options
protected ReflectionClass $reflected
Résultat ReflectionClass