get() публичный Метод

get item from config
С версии: 2.2.0
public get ( string $key = null ) : mixed
$key string key of the item
Результат mixed
Пример #1
0
 /**
  * init the class
  *
  * @since 2.2.0
  *
  * @param Config $config instance of the config class
  */
 public static function init(Config $config)
 {
     self::$_config = $config;
     $dbType = $config->get('dbType');
     $dbHost = $config->get('dbHost');
     $dbName = $config->get('dbName');
     $dbUser = $config->get('dbUser');
     $dbPassword = $config->get('dbPassword');
     /* mysql and pgsql */
     if ($dbType === 'mysql' || $dbType === 'pgsql') {
         if ($dbType === 'mysql') {
             self::configure('connection_string', 'mysql:host=' . $dbHost . ';dbname=' . $dbName . ';charset=utf8');
         } else {
             self::configure('connection_string', 'pgsql:host=' . $dbHost . ';dbname=' . $dbName . ';options=--client_encoding=utf8');
         }
         /* username and password */
         self::configure(array('username' => $dbUser, 'password' => $dbPassword));
     }
     /* sqlite */
     if ($dbType === 'sqlite') {
         self::configure('sqlite:' . $dbHost);
     }
     /* general */
     self::configure(array('caching' => true, 'caching_auto_clear' => true, 'return_result_sets' => true));
 }
Пример #2
0
 /**
  * testGetAll
  *
  * @since 2.2.0
  */
 public function testGetAll()
 {
     /* result */
     $result = Config::get();
     /* compare */
     $this->assertArrayHasKey('host', $result);
 }
Пример #3
0
 /**
  * for table with prefix
  *
  * @since 2.2.0
  *
  * @param string $table name of the table
  * @param string $connection which connection to use
  *
  * @return Db
  */
 public static function forPrefixTable($table = null, $connection = self::DEFAULT_CONNECTION)
 {
     self::_setupDb($connection);
     return new self(Config::get('prefix') . $table, array(), $connection);
 }