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

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

do we have a config entry called $name?
public hasEntry ( string $name ) : boolean
$name string the name of the config to check for
Результат boolean
    public function hasEntry($name)
    {
        if (!isset($this->list[$name])) {
            return false;
        }
        return true;
    }

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'));
 }