getPureVal() 공개 메소드

returns config pure value
public getPureVal ( string $key, mixed $default = null, string $siteKey = 'default' ) : mixed
$key string the name of target including entity name
$default mixed if not exists, be return
$siteKey string site key
리턴 mixed
 /**
  * 주어진 타겟과 그 타겟에 지정된 스킨의 설정정보를 가져온다. 주어진 타겟에 한번이라도 지정된 적이 있는 스킨정보를 모두 가져온다.
  * 두번째 파라메터가 있을 경우, 주어진 스킨의 설정정보만 가져온다.
  *
  * @param string $key    target key
  * @param string $skinId skin id
  *
  * @return mixed
  */
 public function getConfigs($key, $skinId = null)
 {
     $key = $this->makeStoreKey(static::PREFIX_KEY_CONFIGS, $key);
     if ($skinId === null) {
         $config = $this->store->get($key);
         return $config->getPureAll();
     } else {
         $config = $this->store->getPureVal("{$key}.{$skinId}", []);
         return $config;
     }
 }
예제 #2
0
 public function testGetPureValReturnsPureValue()
 {
     list($repo, $validator) = $this->getMocks();
     $mockConfig = m::mock('Xpressengine\\Config\\ConfigEntity');
     $mockConfig->name = 'board.notice';
     $mockConfig->shouldReceive('getPure')->with('listCount', null)->andReturn(0);
     $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->getPureVal('board.notice.listCount');
     $this->assertEquals(0, $val);
 }