public function setNormalizer($option, \Closure $normalizer)
    {
        if ($this->locked) {
            throw new AccessException('Normalizers cannot be set from a lazy option or normalizer.');
        }

        if (!isset($this->defined[$option])) {
            throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined))));
        }

        $this->normalizers[$option] = [$normalizer];

        // Make sure the option is processed
        unset($this->resolved[$option]);

        return $this;
    }
public function setNormalizer($option, \Closure $normalizer)
    {
        if ($this->locked) {
            throw new AccessException('Normalizers cannot be set from a lazy option or normalizer.');
        }

        if (!isset($this->defined[$option])) {
            throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined))));
        }

        $this->normalizers[$option] = [$normalizer];

        // Make sure the option is processed
        unset($this->resolved[$option]);

        return $this;
    }
public function setNormalizer ( $ option , \ Closure $ normalizer ) { if ( $ this -> locked ) { throw new AccessException ( 'Normalizers cannot be set from a lazy option or normalizer.' ) ; } if ( ! isset ( $ this -> defined [ $ option ] ) ) { throw new UndefinedOptionsException ( sprintf ( 'The option "%s" does not exist. Defined options are: "%s".' , $ option , implode ( '", "' , array_keys ( $ this -> defined ) ) ) ) ; } $ this -> normalizers [ $ option ] = [ $ normalizer ] ; // Make sure the option is processed unset ( $ this -> resolved [ $ option ] ) ; return $ this ; }
Sets the normalizer for an option.

The normalizer should be a closure with the following signature:

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.

@param string   $option     The option name
@param \Closure $normalizer The normalizer

@return $this

@throws UndefinedOptionsException If the option is undefined
@throws AccessException           If called from a lazy option or normalizer
Sets the normalizer for an option .