Dibi\Connection::getConfig PHP Méthode

getConfig() final public méthode

Returns configuration variable. If no $key is passed, returns the entire array.
See also: self::__construct
final public getConfig ( $key = NULL, $default = NULL ) : mixed
Résultat mixed
    public final function getConfig($key = NULL, $default = NULL)
    {
        if ($key === NULL) {
            return $this->config;
        } elseif (isset($this->config[$key])) {
            return $this->config[$key];
        } else {
            return $default;
        }
    }

Usage Example

Exemple #1
0
 /**
  * @return IAdapter
  */
 public function getAdapter()
 {
     if (!$this->adapter) {
         $driver = ucfirst(strtolower($this->connection->getConfig('driver')));
         switch ($driver) {
             case IAdapter::DRIVER_MYSQL:
             case IAdapter::DRIVER_MYSQLI:
                 $class = 'Joseki\\Migration\\Database\\Adapters\\MysqlAdapter';
                 break;
             case IAdapter::DRIVER_SQLSRV:
                 $class = 'Joseki\\Migration\\Database\\Adapters\\SqlsrvAdapter';
                 break;
             default:
                 // fallback
                 $class = self::$defaultAdapter;
                 break;
         }
         $this->adapter = new $class($this->connection, $this->table);
     }
     return $this->adapter;
 }