OptionsResolver::setNormalizer()

OptionsResolver setNormalizer(string $option, Closure $normalizer)

Sets the normalizer for an option.

The normalizer should be a closure with the following signature:

php function (Options $options, $value) { // ... }

The closure is invoked when {@link resolve()} is called. The closure has access to the resolved values of other options through the passed {@link Options} instance.

The second parameter passed to the closure is the value of the option.

The resolved option value is set to the return value of the closure.

Parameters

string $option The option name
Closure $normalizer The normalizer

Return Value

OptionsResolver This instance

Exceptions

UndefinedOptionsException If the option is undefined
AccessException If called from a lazy option or normalizer
doc_Symfony
2016-10-28 06:25:18
Comments
Leave a Comment

Please login to continue.