Graby\SiteConfig\ConfigBuilder::build PHP Method

build() public method

Will add the merged result to cache if $addToCache is set to true
Deprecation: Use either buildForHost() / buildFromUrl() for the merged config or loadSiteConfig() to get the config for a site
public build ( string $host, boolean $exactHostMatch = false ) : false | SiteConfig
$host string Host, like en.wikipedia.org
$exactHostMatch boolean if true, we will not look for wildcard config matches
return false | SiteConfig
    public function build($host, $exactHostMatch = false)
    {
        return $this->loadSiteConfig($host, $exactHostMatch);
    }

Usage Example

コード例 #1
0
ファイル: ConfigBuilderTest.php プロジェクト: harikt/graby
 public function testBuildWithCachedVersion()
 {
     $configBuilder = new ConfigBuilder(array('site_config' => array(dirname(__FILE__) . '/../fixtures/site_config')));
     $res = $configBuilder->build('fr.wikipedia.org');
     $this->assertInstanceOf('Graby\\SiteConfig\\SiteConfig', $res);
     $configBuilder->addToCache($res->cache_key, $res);
     $res2 = $configBuilder->build('fr.wikipedia.org');
     $this->assertInstanceOf('Graby\\SiteConfig\\SiteConfig', $res);
     $this->assertEquals($res, $res2, 'Config retrieve from cache');
 }