Пример #1
0
 /**
  * Returns the current element in the target collection after inserting
  * the value from the source collection into the specified path.
  *
  * @return mixed
  */
 public function current()
 {
     $row = parent::current();
     if (!$this->_validValues) {
         return $row;
     }
     $pointer =& $row;
     foreach ($this->_path as $step) {
         if (!isset($pointer[$step])) {
             return $row;
         }
         $pointer =& $pointer[$step];
     }
     $pointer[$this->_target] = $this->_values->current();
     return $row;
 }
Пример #2
0
 /**
  * Returns whether or not the iterator has more elements
  *
  * @return bool
  */
 public function valid()
 {
     if ($this->_buffer->offsetExists($this->_index)) {
         $current = $this->_buffer->offsetGet($this->_index);
         $this->_current = $current['value'];
         $this->_key = $current['key'];
         return true;
     }
     $valid = parent::valid();
     if ($valid) {
         $this->_current = parent::current();
         $this->_key = parent::key();
         $this->_buffer->push(['key' => $this->_key, 'value' => $this->_current]);
     }
     $this->_finished = !$valid;
     return $valid;
 }
Пример #3
0
 /**
  * Returns the value returned by the callback after passing the current value in
  * the iteration
  *
  * @return mixed
  */
 public function current()
 {
     $callback = $this->_callback;
     return $callback(parent::current(), $this->key(), $this->_innerIterator);
 }
Пример #4
0
 /**
  * Returns the column value defined in $path or null if the path could not be
  * followed
  *
  * @return mixed
  */
 public function current()
 {
     $current = parent::current();
     return $this->_extract($current, $this->_path);
 }
Пример #5
0
 /**
  * Returns the column value defined in $path or null if the path could not be
  * followed
  *
  * @return mixed
  */
 public function current()
 {
     $extractor = $this->_extractor;
     return $extractor(parent::current());
 }