本文整理汇总了PHP中Map::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP Map::remove方法的具体用法?PHP Map::remove怎么用?PHP Map::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map::remove方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search
/**
*
* @param <type> $table
* @param ArrayIterator $params
* @return ArrayObject
*/
public function search($table, ArrayIterator $params)
{
$this->searchParams = $params;
$this->join();
if ($table == "analysis") {
$this->statements->remove("type_event");
}
$statement = "SELECT this_.* " . $this->selectAttributes() . " FROM {$table} this_ ";
$statement .= $this->join();
$i = 0;
$this->searchParams->rewind();
if ($this->searchParams->count() > 0 && !$this->searchParams->offsetExists('true')) {
$statement .= " WHERE ";
}
while ($this->searchParams->valid()) {
if ($this->statements->containsKey($this->searchParams->key())) {
if ($i++ > 0) {
$statement .= " AND ";
}
$clause = $this->statements->get($this->searchParams->key());
$statement .= str_replace(":" . $this->searchParams->key(), "'" . $this->searchParams->current() . "'", $clause['where']);
}
$this->searchParams->next();
}
return $this->getObject($statement . " ORDER BY this_.date DESC, this_.id DESC");
}
示例2: getAllLinesValues
public function getAllLinesValues()
{
$titles = $this->values->get("rowTitles");
$this->values->remove("rowTitles");
$valuesToReturn = $this->values->values();
$this->setTitles($titles);
return $valuesToReturn;
}
示例3: testRemovePath
public function testRemovePath()
{
$this->object = new Map();
$path = Path::factory('/test/description', 'description');
$path2 = Path::factory('/test/properties/property', 'props')->loop(true, '@inexistant');
$this->object->add(array($path, $path2));
$this->assertEquals(2, count($this->object->getPaths()));
$this->object->remove($path);
$this->assertEquals(1, count($this->object->getPaths()));
}
示例4: removeAffectsGivenKeyOnly
/** @test */
public function removeAffectsGivenKeyOnly()
{
$map = new Map(array('foo' => 42, 'bar' => 1337));
$map->remove('foo');
$this->assertFalse($map->hasKey('foo'));
$this->assertEquals(1337, $map->get('bar'));
}
示例5: testKeysLocked
public function testKeysLocked()
{
$map = new Map(['foo6' => 'bar6'], true);
$success = false;
try {
$map->set('foo7', 'bar7');
} catch (\RuntimeException $e) {
$success = true;
}
$this->assertTrue($success);
$this->assertTrue($map->remove('foo6')->has('foo6'));
$this->assertEquals('bar6', $map->set('foo6', 'bar6')->get('foo6'));
$this->assertEquals(['foo6' => null], $map->clear()->toArray());
}
示例6: test_remove
/**
* @dataProvider provider__construct
*/
public function test_remove($base, $diff)
{
$map = new Map($base);
foreach ($base as $key => $value) {
$this->assertEquals($map->get($key), $value);
}
foreach ($diff as $key => $value) {
$map->remove($key);
unset($base[$key]);
}
foreach ($base as $key => $value) {
$this->assertEquals($map->get($key), $value);
}
}