private function configureDatabase(array $config) {
        if (!isset($config['database']) || !isset($config['database']['adapter'])) {
            throw new InvalidArgumentException('Missing database adapter configuration for the image variations event listener', 500);
        }

        $config = $config['database'];

        if (is_callable($config['adapter'])) {
            $databaseAdapter = $config['adapter']();
        } else if (is_string($config['adapter'])) {
            $databaseAdapter = new $config['adapter'](isset($config['params']) ? $config['params'] : null);
        } else {
            $databaseAdapter = $config['adapter'];
        }

        if (!($databaseAdapter instanceof DatabaseInterface)) {
            throw new InvalidArgumentException('Invalid database adapter for the image variations event listener', 500);
        }

        $this->database = $databaseAdapter;
    }
private function configureDatabase(array $config) {
        if (!isset($config['database']) || !isset($config['database']['adapter'])) {
            throw new InvalidArgumentException('Missing database adapter configuration for the image variations event listener', 500);
        }

        $config = $config['database'];

        if (is_callable($config['adapter'])) {
            $databaseAdapter = $config['adapter']();
        } else if (is_string($config['adapter'])) {
            $databaseAdapter = new $config['adapter'](isset($config['params']) ? $config['params'] : null);
        } else {
            $databaseAdapter = $config['adapter'];
        }

        if (!($databaseAdapter instanceof DatabaseInterface)) {
            throw new InvalidArgumentException('Invalid database adapter for the image variations event listener', 500);
        }

        $this->database = $databaseAdapter;
    }
private function configureDatabase ( array $ config ) { if ( ! isset ( $ config [ 'database' ] ) || ! isset ( $ config [ 'database' ] [ 'adapter' ] ) ) { throw new InvalidArgumentException ( 'Missing database adapter configuration for the image variations event listener' , 500 ) ; } $ config = $ config [ 'database' ] ; if ( is_callable ( $ config [ 'adapter' ] ) ) { $ databaseAdapter = $ config [ 'adapter' ] ( ) ; } else if ( is_string ( $ config [ 'adapter' ] ) ) { $ databaseAdapter = new $ config [ 'adapter' ] ( isset ( $ config [ 'params' ] ) ? $ config [ 'params' ] : null ) ; } else { $ databaseAdapter = $ config [ 'adapter' ] ; } if ( ! ( $ databaseAdapter instanceof DatabaseInterface ) ) { throw new InvalidArgumentException ( 'Invalid database adapter for the image variations event listener' , 500 ) ; } $ this -> database = $ databaseAdapter ; }
Configure the database adapter

@param array $config The event listener configuration
@throws InvalidArgumentException
Configure the database adapter