本文整理汇总了PHP中AkConfig::get方法的典型用法代码示例。如果您正苦于以下问题:PHP AkConfig::get方法的具体用法?PHP AkConfig::get怎么用?PHP AkConfig::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AkConfig
的用法示例。
在下文中一共展示了AkConfig::get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_get_with_and_without_cache
public function test_get_with_and_without_cache()
{
$expectedConfig = array('value1' => 1, 'value2' => 2, 'value3' => array('subvalue1' => 1, 'subvalue2' => 2, 'subvalue3' => 5, 'subvalue4' => array('subsubvalue1' => 2)));
$config = $this->Config->get('testconfig1', 'testing');
$this->assertEqual($expectedConfig, $config);
$expectedConfig = array('value1' => 100, 'value2' => 2, 'value3' => array('subvalue1' => 1, 'subvalue2' => 2, 'subvalue3' => 7, 'subvalue4' => array('subsubvalue1' => 13)));
$reader = new AkConfig(array('skip_cache' => true));
$config = $reader->get('testconfig1', 'production');
$this->assertEqual($expectedConfig, $config);
}
示例2: getSettings
/**
* Returns YAML settings from config/$namespace.yml
*/
function getSettings($namespace, $raise_error_if_config_file_not_found = true, $environment = AK_ENVIRONMENT)
{
static $_config;
if (!in_array($environment, Ak::toArray(AK_AVAILABLE_ENVIRONMENTS))) {
trigger_error('The environment ' . $environment . ' is not allowed. Allowed environments: ' . AK_AVAILABLE_ENVIRONMENTS);
return false;
}
if (!isset($_config)) {
require_once AK_LIB_DIR . DS . 'AkConfig.php';
$_config = new AkConfig();
}
return $_config->get($namespace, $environment, $raise_error_if_config_file_not_found);
}
示例3: array
function _checkDbConfig($type, $settings = array())
{
$this->debug('Checking if database config for "' . $type . '" is available');
require_once AK_BASE_DIR . DS . 'lib' . DS . 'AkActiveRecord' . DS . 'AkDbAdapter.php';
require_once AK_LIB_DIR . DS . 'Ak.php';
if (empty($settings)) {
require_once AK_BASE_DIR . DS . 'lib' . DS . 'AkConfig.php';
$config = new AkConfig();
$settings = $config->get($type, 'testing');
}
$db = new AkDbAdapter($settings);
$db->connect(false);
if (!($res = $db->connected())) {
$this->error("[{$type}] " . 'Cannot connect to DB');
} else {
$this->info("[{$type}] " . 'Successfully connected to database ' . ($settings['type'] == 'sqlite' ? $settings['database_file'] : $settings['database_name']));
$createRes = $db->execute('CREATE table ci_test_dummy(id integer)');
if (!$createRes) {
$res = false;
$this->error("[{$type}] " . 'Could not create test table: ci_test_dummy');
} else {
$res = true;
$this->info("[{$type}] " . 'Successfully created test table: ci_test_dummy');
$db->execute('DROP table ci_test_dummy');
}
}
return $res;
}
示例4: getSettings
/**
* Returns YAML settings from config/$namespace.yml
*/
static function getSettings($namespace, $raise_error_if_config_file_not_found = true, $environment = AK_ENVIRONMENT)
{
static $_config;
if ($raise_error_if_config_file_not_found && !in_array($environment, Ak::toArray(AK_AVAILABLE_ENVIRONMENTS))) {
trigger_error('The environment ' . $environment . ' is not allowed. Allowed environments: ' . AK_AVAILABLE_ENVIRONMENTS, E_USER_ERROR);
return false;
}
if (!isset($_config)) {
$_config = new AkConfig();
}
return $_config->get($namespace, $environment, $raise_error_if_config_file_not_found);
}
示例5: load_config
private function load_config(){
if(empty($this->config)){
$config = new AkConfig();
$this->config = $config->get('tpv',TPV_MODE);
$unknown_properties = array();
foreach($this->config as $conf => $value){
if(in_array($conf,Payment::getProperties())){
($conf=='language' || $conf=='currency') && !is_numeric($value) && $value=constant($value);
$this->$conf = $value;
}else{
$this->unknown_properties[] = $conf;
}
}
}
is_array($this->unknown_properties) && $this->unknown_properties = count($this->unknown_properties);
return $this->unknown_properties;
}