本文整理汇总了PHP中ArrayObject::offsetUnset方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayObject::offsetUnset方法的具体用法?PHP ArrayObject::offsetUnset怎么用?PHP ArrayObject::offsetUnset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayObject
的用法示例。
在下文中一共展示了ArrayObject::offsetUnset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unregisterObserver
/**
* @param Observer $observer
*/
public function unregisterObserver(Observer $observer)
{
$key = array_search($observer, $this->observers->getArrayCopy(), true);
if ($key) {
$this->observers->offsetUnset($key);
}
}
示例2: clear
/**
* Clear datas with $uid key
* @param mixed $uid
* @return void
*/
public function clear($uid = null)
{
$this->alloc();
if ($uid) {
return $this->session->offsetUnset($uid);
}
return $this->session->exchangeArray(array());
}
示例3: remove
public function remove(IcingaDoctrineQueryFilterChain $filter)
{
foreach ($this->filters as $fid => $checkFilter) {
if ($checkFilter === $filter) {
$this->filters->offsetUnset($fid);
return true;
}
}
return false;
}
示例4: offsetUnset
public function offsetUnset($task)
{
$this->db->prepare($this->delete)->execute($task);
if (parent::offsetExists($task)) {
parent::offsetUnset($task);
}
}
示例5: flushMessages
/**
* Get flash messages, and reset storage
* @return array Messages to show for current request
*/
public function flushMessages()
{
$messages = $this->storage->getArrayCopy();
// clear storage items. will attempt to handle multiple types here as
// it seems that some types prefer get_object_vars
if ($this->storage instanceof \ArrayObject) {
foreach (get_object_vars($this->storage) as $key => $value) {
$this->storage->offsetUnset($key);
}
} else {
foreach ($this->storage as $key => $value) {
$this->storage->offsetUnset($key);
}
}
return $messages;
}
示例6: deleteConstant
/**
* Delete constant from constant list
*
* @param string $constant
*
* @return bool
*/
public function deleteConstant($constant)
{
if (($index = array_search($constant, $this->constants->getArrayCopy())) !== false) {
$this->constants->offsetUnset($index);
}
return $index !== false;
}
示例7: offsetUnset
public function offsetUnset($index)
{
if ($this->offsetExists($index)) {
parent::offsetUnset($index);
$this->sync();
}
}
示例8: offsetUnset
public function offsetUnset($name)
{
if ($this->offsetExists($name)) {
$node = $this->offsetGet($name);
$node->parentNode = null;
}
parent::offsetUnset($name);
}
示例9: offsetUnset
public function offsetUnset($key)
{
if (isset($_SESSION[$key])) {
unset($_SESSION[$key]);
parent::offsetUnset($key);
}
return true;
}
示例10: removeItemAt
/**
*
* Simple test comment.
*
* FANOUT := 3
* CALLS := 3
*
* @param ArrayAccess $items The input items.
* @param integer $index The requested index.
*
* @return void
* @throws OutOfRangeException For invalid index values.
*/
function removeItemAt(ArrayObject $items, $index)
{
if (is_int($index) === false) {
throw new InvalidArgumentException('Error');
}
if (!$items->offsetExists($index)) {
throw new OutOfRangeException('Error...');
}
$items->offsetUnset($index);
}
示例11: remove
/**
* Removes an Object from Collection
*
* @param integer $index
* Offset to remove
*
* @return Next\Components\Iterator\AbstractCollection
* Collection Object (Fluent Interface)
*/
public function remove($index)
{
$index = (int) $index;
// If offset exists in Objects Collection and Objects References...
if ($this->collection->offsetExists($index) && $this->references->offsetExists($index)) {
// ... let's remove them
$this->collection->offsetUnset($index);
$this->references->offsetUnset($index);
}
return $this;
}
示例12: skipWhileOf
/**
* 指定された条件が満たされる限り、シーケンスの要素をバイパスした後、残りの要素を返します。
*
* @param \ArrayObject $source 返される要素が含まれるシーケンス
* @param \Closure $predicate 各要素が条件を満たしているかどうかをテストする関数
*
* @return \ArrayObject テストに初めて合格しない要素から入力シーケンスの最後の要素までのシーケンス
*/
public function skipWhileOf(\ArrayObject $source, \Closure $predicate) : \ArrayObject
{
$skipped = new \ArrayObject($source->getArrayCopy());
foreach ($source->getIterator() as $key => $value) {
if ($predicate($value) === false) {
break;
}
$skipped->offsetUnset($key);
}
return new \ArrayObject(array_values($skipped->getArrayCopy()));
}
示例13: remove
/**
* Removes the first occurrence of the specified element.
* @param mixed
* @return bool true if this collection changed as a result of the call
* @throws NotSupportedException
*/
public function remove($item)
{
$this->updating();
$index = $this->search($item);
if ($index === FALSE) {
return FALSE;
} else {
parent::offsetUnset($index);
return TRUE;
}
}
示例14: setProperties
private function setProperties($_class)
{
# armazena a classe principal
// $class->getProperties(): recupera lista de atributos da classe
foreach ($this->reflection->getProperties() as $attributes) {
# recupera os comentários dos atributos
$doc = $attributes->getDocComment();
$doc = str_replace("/**", "", $doc);
$doc = str_replace("*/", "", $doc);
# gera um array de comentários
$doc = explode('*', $doc);
# cria um array com a classe ArrayObject
$doc = new \ArrayObject($doc);
# retira o primeiro elemento vazio do array
$doc->offsetUnset(0);
# análise do array de documentação
foreach ($doc as $vDoc) {
# identifica o atributo da classe vinculada
if (strstr($vDoc, "@class")) {
$var = explode("@class", $vDoc);
# $this->class = trim ( $var[1] );
$_class = trim($var[1]);
}
# identifica o atributo primary key
if (strstr($vDoc, "@pk")) {
$this->pk = $attributes->getName();
}
# identifica o atributo foreign key
if (strstr($vDoc, "@fk")) {
$this->fk[] = $attributes->getName();
}
# identifica uma classe referenciada de relacionamento M x N
if (strstr($vDoc, "@referencedTable")) {
$this->referencedTable[] = $attributes->getName();
}
# ---------------------------------------------
# INSERIR NOVAS REGRAS AQUI
# ---------------------------------------------
}
$this->classes[$_class] = $_class;
if ($this->classePrincipal == $_class) {
# armazena as propriedades da classe principal
$this->properties[$this->classePrincipal][] = $attributes->getName();
} else {
# armazena as propriedades da classe derivada
$this->properties[$_class] = $attributes->getName();
}
# $_class recebe seu valor original
$_class = $this->classePrincipal;
}
// fim do foreach
$this->properties;
}
示例15: _parseArguments
/**
* Parses the given arguments
*
* @return void
* @throws Brawler_Console_Exception
*/
public static function _parseArguments()
{
self::$_arguments = new Brawler_Console_Argument_List();
$args = new ArrayObject($_SERVER['argv']);
$args->offsetUnset(0);
$i = $args->getIterator();
while ($i->valid()) {
if (substr($i->current(), 0, 1) == '-') {
// parse argument
self::_parseArgument($i->current());
} else {
// invalid call
throw new Brawler_Console_Exception('Invalid call');
}
$i->next();
}
}