コード例 #1
0
 function actionDefault()
 {
     // Set some variables
     YDConfig::set('MyConfigVar1', 'value cfg1');
     YDConfig::set('MyConfigVar2', 'value cfg2');
     YDConfig::set('MyConfigVar3', 'value cfg3');
     // Get the values
     YDDebugUtil::dump(YDConfig::get('MyConfigVar1'), 'get - MyConfigVar1');
     YDDebugUtil::dump(YDConfig::get('MyConfigVar2'), 'get - MyConfigVar2');
     YDDebugUtil::dump(YDConfig::get('MyConfigVar3'), 'get - MyConfigVar3');
     // Check if the variables exist or not
     YDDebugUtil::dump(YDConfig::exists('MyConfigVar1'), 'exists - MyConfigVar1');
     YDDebugUtil::dump(YDConfig::exists('MyConfigVar2'), 'exists - MyConfigVar2');
     YDDebugUtil::dump(YDConfig::exists('MyConfigVar3'), 'exists - MyConfigVar3');
     // Check an unexisting variable
     YDDebugUtil::dump(YDConfig::exists('xx'), 'exists - xx');
     // Set some variables, not overriding existing values
     YDConfig::set('MyConfigVar1', 'value cfg1 changed', false);
     YDConfig::set('MyConfigVar2', 'value cfg2 changed', false);
     YDConfig::set('MyConfigVar3', 'value cfg3 changed', false);
     // Get the values (should be unchanged)
     YDDebugUtil::dump(YDConfig::get('MyConfigVar1'), 'get - MyConfigVar1 - changed1');
     YDDebugUtil::dump(YDConfig::get('MyConfigVar2'), 'get - MyConfigVar2 - changed1');
     YDDebugUtil::dump(YDConfig::get('MyConfigVar3'), 'get - MyConfigVar3 - changed1');
     // Set some variables, overriding existing values
     YDConfig::set('MyConfigVar1', 'value cfg1 changed', true);
     YDConfig::set('MyConfigVar2', 'value cfg2 changed', true);
     YDConfig::set('MyConfigVar3', 'value cfg3 changed', true);
     // Get the values (should be changed)
     YDDebugUtil::dump(YDConfig::get('MyConfigVar1'), 'get - MyConfigVar1 - changed2');
     YDDebugUtil::dump(YDConfig::get('MyConfigVar2'), 'get - MyConfigVar2 - changed2');
     YDDebugUtil::dump(YDConfig::get('MyConfigVar3'), 'get - MyConfigVar3 - changed2');
     // Dump the contents of YDConfig
     YDConfig::dump();
 }