DataSift\Storyplayer\ConfigLib\ConfigList::getEntry PHP Метод

getEntry() публичный Метод

retrieve a single config entry
public getEntry ( string $name ) : array | object
$name string the name of the config to retrieve
Результат array | object
    public function getEntry($name)
    {
        if (!isset($this->list[$name])) {
            throw new E4xx_NoSuchConfigEntry($name);
        }
        return $this->list[$name];
    }

Usage Example

Пример #1
0
 /**
  * @covers DataSift\Storyplayer\ConfigLib\ConfigList::__construct
  * @covers DataSift\Storyplayer\ConfigLib\ConfigList::addHardCodedList
  */
 public function testCanAddEntriesFromAHardCodedList()
 {
     // ----------------------------------------------------------------
     // setup your test
     $obj = new ConfigList("DataSift\\Storyplayer\\ConfigLib\\WrappedConfig", __DIR__ . '/ConfigListTestData1');
     $hardCodedList = new HardCodedList('DataSift\\Storyplayer\\ConfigLib\\WrappedConfig');
     $expected1 = $hardCodedList->newConfig('hard-coded-config-1');
     $expected1->getConfig()->name = 'config-1';
     $expected2 = $hardCodedList->newConfig('hard-coded-config-2');
     $expected2->getConfig()->name = 'config-2';
     // ----------------------------------------------------------------
     // perform the change
     $obj->addHardCodedList($hardCodedList);
     // ----------------------------------------------------------------
     // test the results
     $this->assertTrue($obj->hasEntry('hard-coded-config-1'));
     $this->assertSame($expected1, $obj->getEntry('hard-coded-config-1'));
     $this->assertTrue($obj->hasEntry('hard-coded-config-2'));
     $this->assertSame($expected2, $obj->getEntry('hard-coded-config-2'));
 }