src/Core.php
public static function initialize($configuration = array(), $cache_object = null)
        {
            try {
                if (array_key_exists('dsn', $configuration) && $configuration['dsn'])
                    self::setDSN($configuration['dsn']);
                if (array_key_exists('driver', $configuration) && $configuration['driver'])
                    self::setDriver($configuration['driver']);
                if (array_key_exists('hostname', $configuration) && $configuration['hostname'])
                    self::setHostname($configuration['hostname']);
                if (array_key_exists('port', $configuration) && $configuration['port'])
                    self::setPort($configuration['port']);
                if (array_key_exists('username', $configuration) && $configuration['username'])
                    self::setUsername($configuration['username']);
                if (array_key_exists('password', $configuration) && $configuration['password'])
                    self::setPassword($configuration['password']);
                if (array_key_exists('database', $configuration) && $configuration['database'])
                    self::setDatabaseName($configuration['database']);
                if (array_key_exists('tableprefix', $configuration) && $configuration['tableprefix'])
                    self::setTablePrefix($configuration['tableprefix']);
                if (array_key_exists('debug', $configuration))
                    self::setDebugMode((bool) $configuration['debug']);
                if (array_key_exists('caching', $configuration))
                    self::setCacheEntities((bool) $configuration['caching']);

                if ($cache_object !== null) {
                    if (is_callable($cache_object)) {
                        self::$cache_object = call_user_func($cache_object);
                    } else {
                        self::$cache_object = $cache_object;
                    }
                }

                if (!self::$cache_object) {
                    self::$cache_object = new Cache(Cache::TYPE_DUMMY);
                    self::$cache_object->disable();
                }
            } catch (\Exception $e) {
                throw $e;
            }
        }
public static function initialize($configuration = array(), $cache_object = null)
        {
            try {
                if (array_key_exists('dsn', $configuration) && $configuration['dsn'])
                    self::setDSN($configuration['dsn']);
                if (array_key_exists('driver', $configuration) && $configuration['driver'])
                    self::setDriver($configuration['driver']);
                if (array_key_exists('hostname', $configuration) && $configuration['hostname'])
                    self::setHostname($configuration['hostname']);
                if (array_key_exists('port', $configuration) && $configuration['port'])
                    self::setPort($configuration['port']);
                if (array_key_exists('username', $configuration) && $configuration['username'])
                    self::setUsername($configuration['username']);
                if (array_key_exists('password', $configuration) && $configuration['password'])
                    self::setPassword($configuration['password']);
                if (array_key_exists('database', $configuration) && $configuration['database'])
                    self::setDatabaseName($configuration['database']);
                if (array_key_exists('tableprefix', $configuration) && $configuration['tableprefix'])
                    self::setTablePrefix($configuration['tableprefix']);
                if (array_key_exists('debug', $configuration))
                    self::setDebugMode((bool) $configuration['debug']);
                if (array_key_exists('caching', $configuration))
                    self::setCacheEntities((bool) $configuration['caching']);

                if ($cache_object !== null) {
                    if (is_callable($cache_object)) {
                        self::$cache_object = call_user_func($cache_object);
                    } else {
                        self::$cache_object = $cache_object;
                    }
                }

                if (!self::$cache_object) {
                    self::$cache_object = new Cache(Cache::TYPE_DUMMY);
                    self::$cache_object->disable();
                }
            } catch (\Exception $e) {
                throw $e;
            }
        }
public static function initialize ( $ configuration = array ( ) , $ cache_object = null ) { try { if ( array_key_exists ( 'dsn' , $ configuration ) && $ configuration [ 'dsn' ] ) self :: setDSN ( $ configuration [ 'dsn' ] ) ; if ( array_key_exists ( 'driver' , $ configuration ) && $ configuration [ 'driver' ] ) self :: setDriver ( $ configuration [ 'driver' ] ) ; if ( array_key_exists ( 'hostname' , $ configuration ) && $ configuration [ 'hostname' ] ) self :: setHostname ( $ configuration [ 'hostname' ] ) ; if ( array_key_exists ( 'port' , $ configuration ) && $ configuration [ 'port' ] ) self :: setPort ( $ configuration [ 'port' ] ) ; if ( array_key_exists ( 'username' , $ configuration ) && $ configuration [ 'username' ] ) self :: setUsername ( $ configuration [ 'username' ] ) ; if ( array_key_exists ( 'password' , $ configuration ) && $ configuration [ 'password' ] ) self :: setPassword ( $ configuration [ 'password' ] ) ; if ( array_key_exists ( 'database' , $ configuration ) && $ configuration [ 'database' ] ) self :: setDatabaseName ( $ configuration [ 'database' ] ) ; if ( array_key_exists ( 'tableprefix' , $ configuration ) && $ configuration [ 'tableprefix' ] ) self :: setTablePrefix ( $ configuration [ 'tableprefix' ] ) ; if ( array_key_exists ( 'debug' , $ configuration ) ) self :: setDebugMode ( ( bool ) $ configuration [ 'debug' ] ) ; if ( array_key_exists ( 'caching' , $ configuration ) ) self :: setCacheEntities ( ( bool ) $ configuration [ 'caching' ] ) ; if ( $ cache_object !== null ) { if ( is_callable ( $ cache_object ) ) { self :: $ cache_object = call_user_func ( $ cache_object ) ; } else { self :: $ cache_object = $ cache_object ; } } if ( ! self :: $ cache_object ) { self :: $ cache_object = new Cache ( Cache :: TYPE_DUMMY ) ; self :: $ cache_object -> disable ( ) ; } } catch ( \ Exception $ e ) { throw $ e ; } }
Initialize B2DB and load related B2DB classes

@param array $configuration [optional] Configuration to load
@param \b2db\interfaces\Cache $cache_object
Initialize B2DB and load related B2DB classes