protected function configureOptions(array $optionsArray): OptionCollection
    {
        $options = new OptionCollection\ArrayOptionCollection();
        foreach ($optionsArray as $key => $option) {
            if ($key === OptionRepository::PREFIX) {
                continue;
            }

            if ($option instanceof Option) {
                $options->add($option);
                continue;
            }

            if (is_callable($option)) {
                $option = $option($this->config);
            }

            if (is_string($option)) {
                $option = new $option();
            }

            if (! $option instanceof Option) {
                throw InvalidOption::fromOption($option);
            }

            $options->add($option);
        }

        return $options;
    }
protected function configureOptions(array $optionsArray): OptionCollection
    {
        $options = new OptionCollection\ArrayOptionCollection();
        foreach ($optionsArray as $key => $option) {
            if ($key === OptionRepository::PREFIX) {
                continue;
            }

            if ($option instanceof Option) {
                $options->add($option);
                continue;
            }

            if (is_callable($option)) {
                $option = $option($this->config);
            }

            if (is_string($option)) {
                $option = new $option();
            }

            if (! $option instanceof Option) {
                throw InvalidOption::fromOption($option);
            }

            $options->add($option);
        }

        return $options;
    }
protected function configureOptions ( array $ optionsArray ) : OptionCollection { $ options = new OptionCollection \ ArrayOptionCollection ( ) ; foreach ( $ optionsArray as $ key => $ option ) { if ( $ key === OptionRepository :: PREFIX ) { continue ; } if ( $ option instanceof Option ) { $ options -> add ( $ option ) ; continue ; } if ( is_callable ( $ option ) ) { $ option = $ option ( $ this -> config ) ; } if ( is_string ( $ option ) ) { $ option = new $ option ( ) ; } if ( ! $ option instanceof Option ) { throw InvalidOption :: fromOption ( $ option ) ; } $ options -> add ( $ option ) ; } return $ options ; }
Build a collection of options from an array of Config values.

@since 0.1.0

@param array $optionsArray Array of config values that are used to build the options.

@return OptionCollection Collection of instantiated options.
Build a collection of options from an array of Config values .