本文整理汇总了PHP中Container::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::remove方法的具体用法?PHP Container::remove怎么用?PHP Container::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Container
的用法示例。
在下文中一共展示了Container::remove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testHasAndRemove
/**
* @param mixed $definition
*
* @dataProvider providerDefinitions
*/
public function testHasAndRemove($definition)
{
$di = new Container();
$di->set('test', $definition);
$this->assertTrue($di->has('test'));
$di->remove('test');
$this->assertFalse($di->has('test'));
}
示例2: remove
public function remove($key)
{
$key = $this->findKey($key);
if ($key === false) {
return;
}
return parent::remove($key);
}
示例3: Container
function test_generic_container()
{
$comp = new Container(new FlowLayout(), MENU, 5);
$c = new Component("Hello!", FOOTER, 4);
$c1 = $comp->add($c, "12px", "2em", LEFT, BOTTOM);
$this->assertReference($c1, $c);
$this->assertReference($comp->getComponent(1), $c);
$this->assertIdentical($comp->getComponentWidth(1), "12px");
$this->assertIdentical($comp->getComponentHeight(1), "2em");
$this->assertIdentical($comp->getComponentAlignmentX(1), LEFT);
$this->assertIdentical($comp->getComponentAlignmentY(1), BOTTOM);
$this->assertIdentical($comp->getComponentsCount(), 1);
$c = new Component("Hello!", MENU_ITEM_LINK_SELECTED, 2);
$c2 = $comp->add($c, "16px", "6em", RIGHT, CENTER);
$this->assertReference($c2, $c);
$this->assertReference($comp->getComponent(2), $c);
$this->assertIdentical($comp->getComponentsCount(), 2);
$c = new Component("Hello!", MENU_ITEM_LINK_UNSELECTED, 5);
$c3 = $comp->add($c, "6px", "2em", CENTER, TOP);
$this->assertReference($c3, $c);
$this->assertReference($comp->getComponent(3), $c);
$this->assertIdentical($comp->getComponentsCount(), 3);
$c = $comp->remove(2);
$this->assertReference($c, $c2);
$this->assertNull($comp->getComponent(2));
$this->assertIdentical($comp->getComponentsCount(), 2);
$comp->removeAll();
$this->assertIdentical($comp->_components, array());
$this->assertIdentical($comp->getComponentsCount(), 0);
}
示例4: testRemove
/**
* @param Container $container
* @depends testMakeContainer
*/
public function testRemove(Container $container)
{
$this->assertEquals('H', $container->remove('h'));
$this->assertFalse($container->has('h'));
}