src/CacheFactory.php
public static function setConfig(array $config)
    {
        if (! isset($config['adapters']) || ! is_array($config['adapters'])) {
            throw new DomainException(
                'Missing adapters configuration.'
            );
        }

        $defaultAdapter = static::DEFAULT_ADAPTER;
        if (isset($config['defaults']['adapter'])) {
            $defaultAdapter = $config['defaults']['adapter'];
        }
        if (! isset($config['adapters'][$defaultAdapter])) {
            throw new DomainException(sprintf(
                'Missing configuration of default adapter "%s".',
                $defaultAdapter
            ));
        }

        foreach ($config['adapters'] as $adapter => $items) {
            if (! isset($items['class'])) {
                throw new DomainException(sprintf(
                    'The class of adapter "%s" is not specified.',
                    $adapter
                ));
            }
        }
        static::$config = $config;
    }
public static function setConfig(array $config)
    {
        if (! isset($config['adapters']) || ! is_array($config['adapters'])) {
            throw new DomainException(
                'Missing adapters configuration.'
            );
        }

        $defaultAdapter = static::DEFAULT_ADAPTER;
        if (isset($config['defaults']['adapter'])) {
            $defaultAdapter = $config['defaults']['adapter'];
        }
        if (! isset($config['adapters'][$defaultAdapter])) {
            throw new DomainException(sprintf(
                'Missing configuration of default adapter "%s".',
                $defaultAdapter
            ));
        }

        foreach ($config['adapters'] as $adapter => $items) {
            if (! isset($items['class'])) {
                throw new DomainException(sprintf(
                    'The class of adapter "%s" is not specified.',
                    $adapter
                ));
            }
        }
        static::$config = $config;
    }
public static function setConfig ( array $ config ) { if ( ! isset ( $ config [ 'adapters' ] ) || ! is_array ( $ config [ 'adapters' ] ) ) { throw new DomainException ( 'Missing adapters configuration.' ) ; } $ defaultAdapter = static :: DEFAULT_ADAPTER ; if ( isset ( $ config [ 'defaults' ] [ 'adapter' ] ) ) { $ defaultAdapter = $ config [ 'defaults' ] [ 'adapter' ] ; } if ( ! isset ( $ config [ 'adapters' ] [ $ defaultAdapter ] ) ) { throw new DomainException ( sprintf ( 'Missing configuration of default adapter "%s".' , $ defaultAdapter ) ) ; } foreach ( $ config [ 'adapters' ] as $ adapter => $ items ) { if ( ! isset ( $ items [ 'class' ] ) ) { throw new DomainException ( sprintf ( 'The class of adapter "%s" is not specified.' , $ adapter ) ) ; } } static :: $ config = $ config ; }
Sets the configuration.

@param array $config The configuration

@throws \DomainException

- If the configuration of adapters not exists.
- If the configuration of adapters is not array.
- If the configuration of default adapter not exists.
- If the class of any adapter is not specified.
Sets the configuration .