Exemplo n.º 1
0
 protected function _pop($pop)
 {
     if (isset($this->_mode)) {
         throw new Mango_Exception('MongoDB cannot pop when already in :mode mode', array(':mode' => $this->_mode));
     }
     if (count($this) === 0) {
         // nothing to pop/shift
         return NULL;
     }
     $this->_mode = 'pop';
     $this->_changed = $pop ? 1 : -1;
     $offset = $pop ? count($this) - 1 : 0;
     $value = $this->offsetGet($offset);
     parent::offsetUnset($offset);
     return $value;
 }
Exemplo n.º 2
0
 public function offsetUnset($key)
 {
     if (isset($this->_counter)) {
         throw new Mango_Exception('This Mango_Array is acting as a counter');
     }
     if ($this->offsetExists($key)) {
         parent::offsetUnset($key);
         $this->_changed[$key] = FALSE;
     }
 }