Example #1
0
 /**
  * @param Observer $observer
  */
 public function unregisterObserver(Observer $observer)
 {
     $key = array_search($observer, $this->observers->getArrayCopy(), true);
     if ($key) {
         $this->observers->offsetUnset($key);
     }
 }
Example #2
0
 /**
  * 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());
 }
 public function remove(IcingaDoctrineQueryFilterChain $filter)
 {
     foreach ($this->filters as $fid => $checkFilter) {
         if ($checkFilter === $filter) {
             $this->filters->offsetUnset($fid);
             return true;
         }
     }
     return false;
 }
Example #4
0
 public function offsetUnset($task)
 {
     $this->db->prepare($this->delete)->execute($task);
     if (parent::offsetExists($task)) {
         parent::offsetUnset($task);
     }
 }
Example #5
0
 /**
  * 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;
 }
 /**
  * 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;
 }
Example #7
0
 public function offsetUnset($index)
 {
     if ($this->offsetExists($index)) {
         parent::offsetUnset($index);
         $this->sync();
     }
 }
Example #8
0
 public function offsetUnset($name)
 {
     if ($this->offsetExists($name)) {
         $node = $this->offsetGet($name);
         $node->parentNode = null;
     }
     parent::offsetUnset($name);
 }
Example #9
0
 public function offsetUnset($key)
 {
     if (isset($_SESSION[$key])) {
         unset($_SESSION[$key]);
         parent::offsetUnset($key);
     }
     return true;
 }
/**
 *
 * 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);
}
Example #11
0
 /**
  * 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;
 }
Example #12
0
 /**
  * 指定された条件が満たされる限り、シーケンスの要素をバイパスした後、残りの要素を返します。
  *
  * @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()));
 }
Example #13
0
 /**
  * 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;
     }
 }
 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;
 }
Example #15
0
 /**
  * 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();
     }
 }
Example #16
0
 function offsetUnset($name)
 {
     $name = strtolower($name);
     parent::offsetUnset($name);
 }
<?php

//重点是演示ArrayObject中的offsetUnset()方法
$array = array('koala', 'kangaroo', 'wombat', 'wallaby', 'emu', 'kiwi', 'kookaburra', 'platypeus');
$array_obj = new ArrayObject($array);
$array_obj->offsetUnset(5);
for ($iterator = $array_obj->getIterator(); $iterator->valid(); $iterator->next()) {
    echo $iterator->key(), "=>", $iterator->current(), "\n";
}
Example #18
0
 /**
  * Store the removed element, so that it can be managed later.
  *
  *     unset($container['foo']);
  *
  * @param   string  identifier
  * @return  void
  */
 public function offsetUnset($key)
 {
     if (isset($this[$key])) {
         $this->__removed[$key] = $this[$key];
     }
     return parent::offsetUnset($key);
 }
Example #19
0
 /**
  * Overloads the `ArrayObject::offsetUnset()` method to ensure keys
  * are lowercase.
  *
  * @param   string  $index
  * @return  void
  * @since   3.2.0
  */
 public function offsetUnset($index)
 {
     return parent::offsetUnset(strtolower($index));
 }
Example #20
0
<?php

$obj = new stdClass();
$obj->var1 = 1;
$ao = new ArrayObject($obj);
$i = $ao->getIterator();
$ao->offsetUnset($i->key());
$i->next();
?>
===DONE===
Example #21
0
 /**
  * Unsets an offset.
  * 
  * (non-PHPdoc)
  *
  * @see ArrayObject::offsetUnset()
  */
 public function offsetUnset($key)
 {
     if ($this->offsetExists($key)) {
         parent::offsetUnset($key);
     }
 }
 public function offsetUnset($index)
 {
     parent::offsetUnset($index);
 }
 /**
  * Remove all arguments and resets this object
  *
  * @return void
  */
 public function removeAll()
 {
     foreach ($this->argumentNames as $argumentName => $booleanValue) {
         parent::offsetUnset($argumentName);
     }
     $this->argumentNames = [];
 }
 public function prepareWeeks()
 {
     $arrayLundi = new ArrayObject(array());
     $arrayMardi = new ArrayObject(array());
     $arrayMercredi = new ArrayObject(array());
     $arrayJeudi = new ArrayObject(array());
     $arrayVendredi = new ArrayObject(array());
     $arraySamedi = new ArrayObject(array());
     for ($i = 0; $i < count($this->JoursList); $i++) {
         if ($this->JoursList[$i]->LibelleJour == "Lundi") {
             $arrayLundi->append($this->JoursList[$i]);
         }
         if ($this->JoursList[$i]->LibelleJour == "Mardi") {
             $arrayMardi->append($this->JoursList[$i]);
         }
         if ($this->JoursList[$i]->LibelleJour == "Mercredi") {
             $arrayMercredi->append($this->JoursList[$i]);
         }
         if ($this->JoursList[$i]->LibelleJour == "Jeudi") {
             $arrayJeudi->append($this->JoursList[$i]);
         }
         if ($this->JoursList[$i]->LibelleJour == "Vendredi") {
             $arrayVendredi->append($this->JoursList[$i]);
         }
         if ($this->JoursList[$i]->LibelleJour == "Samedi") {
             $arraySamedi->append($this->JoursList[$i]);
         }
     }
     // end of old for $i
     $allarray = array($arrayLundi, $arrayMardi, $arrayMercredi, $arrayJeudi, $arrayVendredi, $arraySamedi);
     $max = 0;
     for ($i = 1; $i < count($allarray); $i++) {
         if (count($allarray[$max]) < count($allarray[$i])) {
             $max = $i;
         }
     }
     $arraymax = $allarray[$max];
     //var_dump(count(array_chunk($this->JoursList, 6)));
     for ($i = 0; $i < count($arraymax); $i++) {
         $semaineTemp = array();
         if ($arrayLundi->offsetExists($i) && $arrayMardi->offsetExists($i) && $arrayMercredi->offsetExists($i) && $arrayJeudi->offsetExists($i) && $arrayVendredi->offsetExists($i) && $arraySamedi->offsetExists($i)) {
             array_push($semaineTemp, $arrayLundi[$i]);
             array_push($semaineTemp, $arrayMardi[$i]);
             array_push($semaineTemp, $arrayMercredi[$i]);
             array_push($semaineTemp, $arrayJeudi[$i]);
             array_push($semaineTemp, $arrayVendredi[$i]);
             array_push($semaineTemp, $arraySamedi[$i]);
             $arrayLundi->offsetUnset($i);
             $arrayMardi->offsetUnset($i);
             $arrayMercredi->offsetUnset($i);
             $arrayJeudi->offsetUnset($i);
             $arrayVendredi->offsetUnset($i);
             $arraySamedi->offsetUnset($i);
             array_push($this->SemaineList, new Semaine($semaineTemp));
         }
         //array_push($this->SemaineList, new Semaine($semaineTemp));
     }
     $this->distributeDays($arrayLundi, $arrayMardi, $arrayMercredi, $arrayJeudi, $arrayVendredi, $arraySamedi);
     $this->distributeDays($arrayLundi, $arrayMardi, $arrayMercredi, $arrayJeudi, $arrayVendredi, $arraySamedi);
     $this->distributeDays($arrayLundi, $arrayMardi, $arrayMercredi, $arrayJeudi, $arrayVendredi, $arraySamedi);
     $this->distributeDays($arrayLundi, $arrayMardi, $arrayMercredi, $arrayJeudi, $arrayVendredi, $arraySamedi);
     $this->distributeDays($arrayLundi, $arrayMardi, $arrayMercredi, $arrayJeudi, $arrayVendredi, $arraySamedi);
     $this->distributeDays($arrayLundi, $arrayMardi, $arrayMercredi, $arrayJeudi, $arrayVendredi, $arraySamedi);
     // don't woory a will found a recursive formula for this !!!
     //var_dump($this->SemaineList[0]->Jours[0]->Affectations[0]->Matiere->libelle);
 }
Example #25
0
 /**
  * Esse método analisa a classe passada no parâmetro do construtor
  * e recupera todos os atributos da classe, analisa a documentação
  * do atributo e monta um conjunto de variáveis com base nessa documentação.
  * As seguitnes tags são aceitas:
  * <li>@pk - indica que o atributo refere-se a uma chave primária na tabela
  * 
  * <li>@column - indica que o atributo é uma coluna válida na tabela que 
  * referencia a classe principal. Usar apenas nos atributos 
  * 
  * <li>@referencedClass - indica que esse atributo da classe principal faz 
  * referência a uma outra classe que é fonte dos dados. Normalmente é uma atributo
  * de múltiplos valores do tipo array. Atende ao relacionamento 1 x 1, 1 x N e N x N.
  * Essa tag indica que a chave primária da tabela que representa a classe principal 
  * está referenciada em outra tabela representada pela classe referenciada
  * 
  * <li>@fk
  * @param string $_class
  */
 private function setProperties()
 {
     # 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();
         # retira a primeira linha do comentário
         $doc = str_replace("/**", "", $doc);
         # retira a última linha do comentário
         $doc = str_replace("*/", "", $doc);
         # gera um array com as demais linhas constantes no comentário
         /*
          * Ex: 
          * *@column (linha 1)
          * *@class (linha 2)
          */
         $doc = explode('*', $doc);
         # cria um array com a classe ArrayObject
         # O array $doc armazena todas as tags de um atributo, cada atributo
         # pode ter uma ou mais tags.
         $doc = new \ArrayObject($doc);
         # retira o primeiro elemento do array (elemento vazio)
         $doc->offsetUnset(0);
         # percorre o array de tags do atributo e define cada variável de documentação.
         # ---------------------------------------------------------------
         # DOCUMENTAÇÃO DA CLASSE
         foreach ($doc as $comment) {
             # array de identificadores únicos da classe (primary key)
             if (strstr($comment, "@pk")) {
                 $this->pk = $attributes->getName();
             }
             # array de identificadores únicos da classe (primary key)
             if (strstr($comment, "@fk")) {
                 $this->fk[] = $attributes->getName();
             }
             # array de atributos persistentes da classe
             if (strstr($comment, "@column")) {
                 $this->column[] = $attributes->getName();
                 $this->properties[$this->className][] = $attributes->getName();
             }
             # recupera a lista de classes derivadas (atributo e valor)
             if (strstr($comment, "@class")) {
                 $var = explode("@class", $comment);
                 $this->derivedClass[$attributes->getName()] = trim($var[1]);
                 $this->properties[$this->namespace . '\\' . trim($var[1])] = $attributes->getName();
             }
             # ---------------------------------------------
             # INSERIR NOVAS REGRAS AQUI
             # ---------------------------------------------
             # recupera a lista de classes derivadas (atributo e valor)
             if (strstr($comment, "@autoincrement")) {
                 $this->autoincrement = $attributes->getName();
             }
             # ---------------------------------------------
             # REGRAS DE VALIDAÇÃO
             # ---------------------------------------------
         }
         #foreach ( $doc as $comment )
         # ---------------------------------------------------------------
     }
     // fim do foreach
     $this->properties;
 }
Example #26
0
 /**
  * Remove an option.
  *
  * @param   string  $name  Option name to remove from this set.
  *
  * @return  void
  *
  * @since   1.0
  */
 public function offsetUnset($name)
 {
     $name = $this->resolveAlias($name);
     if (!$this->offsetExists($name)) {
         return;
     }
     parent::offsetUnset($name);
 }
 /**
  * Delete routing item from collection
  * @param $slug
  */
 public function deleteRoutingItem($slug)
 {
     if ($this->routingItemExists($slug)) {
         self::$routingItems->offsetUnset($slug);
     }
 }
Example #28
0
 /**
  * (non-PHPdoc).
  *
  * @see ArrayObject::offsetUnset()
  */
 public function offsetUnset($offset)
 {
     if ($this->_cache) {
         apc_delete($this->_cache_prefix . '-' . $offset);
     }
     return parent::offsetUnset($offset);
 }
Example #29
0
 public function offsetUnset($index)
 {
     if (isset($this->_required[$index])) {
         // Protect required attribute
         throw new Kohana_Exception('Attribute ":attribute" is a required and can not be removed', array(':attribute' => $index));
     }
     if (isset($this->_readonly[$index])) {
         // Protect required attribute
         throw new Kohana_Exception('Attribute ":attribute" is a readonly and can not be removed', array(':attribute' => $index));
     }
     return parent::offsetUnset($index);
 }
Example #30
0
 public function offsetUnset($index)
 {
     parent::offsetUnset(self::validateIndex($index));
 }