getVal() public method

returns config value
public getVal ( string $key, mixed $default = null, boolean $pure = false, string $siteKey = 'default' ) : mixed
$key string the name of target including entity name
$default mixed if not exists, be return
$pure boolean Do not see the parents
$siteKey string site key
return mixed
コード例 #1
0
 /**
  * index
  *
  * @return RendererInterface
  */
 public function index()
 {
     $instanceConfig = InstanceConfig::instance();
     $instanceId = $instanceConfig->getInstanceId();
     $configName = $this->getConfigKeyString($instanceId);
     $includePath = $this->configManager->getVal($configName);
     return XePresenter::make('show', ['includePath' => $includePath]);
 }
コード例 #2
0
 /**
  * getSiteConfigValue
  *
  * @param string      $key     value key
  * @param string|null $siteKey site key
  *
  * @return string
  */
 public function getSiteConfigValue($key, $siteKey = null)
 {
     if (is_null($siteKey)) {
         $siteKey = $this->currentSite->siteKey;
     }
     return $this->config->getVal(sprintf("site.%s.%s", $siteKey, $key));
 }
コード例 #3
0
 public function testGetValReturnsValueWhenExists()
 {
     list($repo, $validator) = $this->getMocks();
     $mockConfig = m::mock('Xpressengine\\Config\\ConfigEntity');
     $mockConfig->name = 'board.notice';
     $mockConfig->shouldReceive('get')->with('listCount', null)->andReturn(10);
     $ancestor = m::mock('Xpressengine\\Config\\ConfigEntity');
     $ancestor->name = 'board';
     $mockConfig->shouldReceive('setParent')->once()->with($ancestor)->andReturnNull();
     $repo->shouldReceive('find')->once()->with('default', 'board.notice')->andReturn($mockConfig);
     $repo->shouldReceive('fetchParent')->with('default', 'board.notice')->andReturn([$ancestor]);
     $instance = new ConfigManager($repo, $validator);
     $val = $instance->getVal('board.notice.listCount');
     $this->assertEquals(10, $val);
 }
コード例 #4
0
 /**
  * 플러그인들의 상태정보를 조회한다.
  *
  * @return mixed
  */
 protected function getPluginsStatus()
 {
     $configs = $this->config->getVal($this->configKey, []);
     return $configs;
 }