src/Viserio/Component/OptionsResolver/Traits/OptionsResolverTrait.php
public static function resolveOptions($config, string $configId = null): array
    {
        $configClass = self::getConfigClass();
        $interfaces  = \class_implements($configClass);
        $dimensions  = [];

        if (isset($interfaces[RequiresComponentConfigContract::class])) {
            $dimensions = $configClass::getDimensions();
        }

        if (isset($interfaces[RequiresConfigIdContract::class]) || isset($interfaces[RequiresComponentConfigIdContract::class])) {
            $dimensions[] = $configId;
        } elseif ($configId !== null) {
            throw new InvalidArgumentException(
                \sprintf('The factory [%s] does not support multiple instances.', $configClass)
            );
        }

        // get configuration for provided dimensions
        $config = self::getConfigurationDimensions($dimensions, $config, $configClass, $interfaces, $configId);

        if ((array) $config !== $config &&
            ! $config instanceof ArrayAccess &&
            isset($interfaces[RequiresComponentConfigIdContract::class])
        ) {
            throw new UnexpectedValueException($configClass::getDimensions());
        }

        if (isset($interfaces[RequiresMandatoryOptionsContract::class])) {
            self::checkMandatoryOptions($configClass, $configClass::getMandatoryOptions(), $config, $interfaces);
        }

        if (isset($interfaces[RequiresValidatedConfigContract::class])) {
            self::validateOptions($configClass::getOptionValidators(), $config, $configClass);
        }

        if (isset($interfaces[ProvidesDefaultOptionsContract::class])) {
            $config = \array_replace_recursive($configClass::getDefaultOptions(), (array) $config);
        }

        if (isset($interfaces[DeprecatedOptionsContract::class])) {
            self::checkDeprecatedOptions($configClass, $configClass::getDeprecatedOptions(), $config);
        }

        return (array) $config;
    }
public static function resolveOptions($config, string $configId = null): array
    {
        $configClass = self::getConfigClass();
        $interfaces  = \class_implements($configClass);
        $dimensions  = [];

        if (isset($interfaces[RequiresComponentConfigContract::class])) {
            $dimensions = $configClass::getDimensions();
        }

        if (isset($interfaces[RequiresConfigIdContract::class]) || isset($interfaces[RequiresComponentConfigIdContract::class])) {
            $dimensions[] = $configId;
        } elseif ($configId !== null) {
            throw new InvalidArgumentException(
                \sprintf('The factory [%s] does not support multiple instances.', $configClass)
            );
        }

        // get configuration for provided dimensions
        $config = self::getConfigurationDimensions($dimensions, $config, $configClass, $interfaces, $configId);

        if ((array) $config !== $config &&
            ! $config instanceof ArrayAccess &&
            isset($interfaces[RequiresComponentConfigIdContract::class])
        ) {
            throw new UnexpectedValueException($configClass::getDimensions());
        }

        if (isset($interfaces[RequiresMandatoryOptionsContract::class])) {
            self::checkMandatoryOptions($configClass, $configClass::getMandatoryOptions(), $config, $interfaces);
        }

        if (isset($interfaces[RequiresValidatedConfigContract::class])) {
            self::validateOptions($configClass::getOptionValidators(), $config, $configClass);
        }

        if (isset($interfaces[ProvidesDefaultOptionsContract::class])) {
            $config = \array_replace_recursive($configClass::getDefaultOptions(), (array) $config);
        }

        if (isset($interfaces[DeprecatedOptionsContract::class])) {
            self::checkDeprecatedOptions($configClass, $configClass::getDeprecatedOptions(), $config);
        }

        return (array) $config;
    }
Returns options based on getDimensions() like [vendor][package] if class implements RequiresComponentConfig
and can perform mandatory option checks if class implements RequiresMandatoryOptions. If the
ProvidesDefaultOptions interface is implemented, these options must be overridden by the provided config.
If you want to allow configurations for more then one instance use RequiresConfigId interface.

The \Viserio\Component\Contract\OptionsResolver\RequiresConfigId interface is supported.

@param array|\ArrayAccess $config
@param null|string        $configId Config name, must be provided if factory uses RequiresConfigId interface

@throws \Viserio\Component\Contract\OptionsResolver\Exception\InvalidArgumentException         If the $configId parameter is provided but factory does not support it
@throws \Viserio\Component\Contract\OptionsResolver\Exception\UnexpectedValueException         If the $config parameter has the wrong type
@throws \Viserio\Component\Contract\OptionsResolver\Exception\OptionNotFoundException          If no options are available
@throws \Viserio\Component\Contract\OptionsResolver\Exception\MandatoryOptionNotFoundException If a mandatory option is missing

@return array