示例#1
0
 /**
  * Returns next entity.
  *
  * @return Entity|null
  */
 public function next()
 {
     if (null !== $this->peek) {
         $entity = $this->peek;
         $this->peek = null;
         return $entity;
     }
     $item = $this->data->current();
     if (null === $item) {
         return null;
     }
     $this->data->next();
     return new Entity($item, $this->accessor, $this->options['mapping'], $this->options['id_path']);
 }
示例#2
0
 function current()
 {
     $value = parent::current();
     $fn = $this->callback;
     $fn($value);
     return $value;
 }
示例#3
0
 /**
  * returns the current element
  *
  * @return  mixed
  */
 public function current()
 {
     $consumeValue = $this->valueConsumer;
     $current = parent::current();
     $consumeValue($current);
     return $current;
 }
示例#4
0
 public function current()
 {
     $row = parent::current();
     $keys = array_keys($row);
     $column = $this->_column ?: array_shift($keys);
     return $row[$column];
 }
 public function current()
 {
     $consumer = $this->consumer;
     $current = parent::current();
     $consumer($current);
     return $current;
 }
示例#6
0
 /**
  * Returns the current value of the iterator
  *
  * @return Mixed Returns NULL if there is no current value
  */
 public function current()
 {
     $this->dumpStart(__FUNCTION__);
     $result = parent::current();
     $this->dumpEnd(__FUNCTION__, $result);
     return $result;
 }
示例#7
0
 public function current()
 {
     $value = parent::current();
     foreach ($this->transformers as $fn) {
         $value = $fn($value);
     }
     return $value;
 }
示例#8
0
 public function next()
 {
     $this->chunk = array();
     for ($i = 0; $i < $this->chunkSize && parent::valid(); $i++) {
         $this->chunk[] = parent::current();
         parent::next();
     }
 }
 /**
  * @inheritDoc
  */
 public function current()
 {
     if (empty($this->_headers)) {
         $this->_headers = parent::current();
         parent::next();
     }
     return array_combine($this->_headers, parent::current());
 }
示例#10
0
 /**
  * Return the current element
  * This method is required by the interface [[\Iterator]].
  * @return mixed current row
  */
 public function current()
 {
     $value = parent::current();
     if (!isset($value['file'])) {
         $value['file'] = $this->collection->createDownload(array_intersect_key($value, ['_id' => true, 'filename' => true, 'length' => true, 'chunkSize' => true]));
     }
     return $value;
 }
 /**
  * for each configured field, if it's in the results, translate it
  *
  * @return array
  **/
 public function current()
 {
     $value = parent::current();
     foreach ($this->_settings['fields'] as $field) {
         $this->_update($value, $field);
     }
     return $value;
 }
示例#12
0
 public function current()
 {
     $value = parent::current();
     foreach ($this->transformers as $fn) {
         $value = call_user_func($fn, $value);
     }
     return $value;
 }
示例#13
0
 public function next()
 {
     $this->chunk = array();
     for ($i = 0; $i < $this->size && parent::valid(); ++$i) {
         $this->chunk[] = parent::current();
         parent::next();
     }
     $this->chunk ? $this->key++ : null;
 }
示例#14
0
 public function current()
 {
     if (!$this->valid()) {
         return NULL;
     }
     $this->_args[0] = parent::current();
     $this->_args[1] = parent::key();
     return call_user_func_array($this->_callback, $this->_args);
 }
示例#15
0
 public function current()
 {
     $out = parent::current();
     if ($this->callback_fn) {
         $modified_out = call_user_func($this->callback_fn, $out);
         return $modified_out;
     }
     return $out;
 }
 public function current()
 {
     //Here we get the actual record to transform!
     $row = parent::current();
     if ($this->formatted) {
         $row = $this->format($row, $this->model);
     }
     return $row;
 }
 public function current()
 {
     $val = parent::current();
     if (!$this->resultselector) {
         return $val;
     } else {
         //project result
         return call_user_func_array($this->resultselector, array($this->aparent, $val));
     }
 }
示例#18
0
 /**
  * {@inheritdoc}
  */
 public function current()
 {
     $neighbourCurrent = $this->neighbour->current();
     $current = parent::current();
     if (!$this->neighbour instanceof Set) {
         $neighbourCurrent = array($neighbourCurrent);
     }
     array_unshift($neighbourCurrent, $current);
     return $neighbourCurrent;
 }
示例#19
0
文件: Callback.php 项目: rafeca/Pinq
 /**
  * Filters each item in the iteration to become the result of a callback
  * function.
  *
  * @return mixed
  */
 public function current()
 {
     $cb = $this->callback;
     $itm = parent::current();
     if ($cb instanceof \Closure) {
         return $cb($itm);
     } else {
         return call_user_func($cb, $itm);
     }
 }
 public function current()
 {
     if (!isset($this->qp)) {
         $this->qp = \QueryPath::with(parent::current(), NULL, $this->options);
     } else {
         $splos = new \SplObjectStorage();
         $splos->attach(parent::current());
         $this->qp->setMatches($splos);
     }
     return $this->qp;
 }
示例#21
0
 /**
  * @param \nochso\WriteMe\Document $document
  *
  * @return \SplFileInfo
  */
 private function findChangelog(Document $document)
 {
     $changelogName = $this->options->getValue('changelog.file');
     $searchDepth = $this->options->getValue('changelog.search-depth');
     $folder = dirname($document->getFilepath());
     $files = new \IteratorIterator(Finder::findFiles($changelogName)->from($folder)->limitDepth($searchDepth));
     $files->next();
     if (!$files->valid()) {
         throw new \RuntimeException(sprintf("Unable to find changelog '%s' in folder '%s'", $changelogName, $folder));
     }
     return $files->current();
 }
示例#22
0
 function current()
 {
     $line = trim(parent::current());
     // split by ' '(space) and \t
     $line = preg_replace('~[\\x20\\x09]+~', ' ', $line);
     $result = explode(self::TOKENS_SEPARATOR, $line);
     $items_count = count($result);
     if ($items_count < 3) {
         throw new phpMorphy_Aot_GramTab_Exception("Can`t split [{$line}] line, too few tokens");
     }
     return $this->processTokens($result);
 }
示例#23
0
 public function valid()
 {
     if (!parent::valid()) {
         return false;
     }
     if ($aKey = FsKey::createKey(parent::current())) {
         $this->aCurrentKey = $aKey;
         return true;
     } else {
         return false;
     }
 }
示例#24
0
 /**
  * Returns the current value of the iterator
  *
  * @return mixed
  */
 public function current()
 {
     $value = parent::current();
     if (is_array($value) && isset($value[$this->field])) {
         return $value[$this->field];
     } else {
         if (is_object($value) && property_exists($value, $this->field)) {
             return $value->{$this->field};
         } else {
             return NULL;
         }
     }
 }
示例#25
0
 function current()
 {
     $string = parent::current();
     if (isset($this->encoding) && $this->encoding !== $this->int_encoding) {
         $result = iconv($this->encoding, $this->int_encoding, $string);
         //$result = mb_convert_encoding($string, $this->int_encoding, $this->encoding);
         if (!is_string($result)) {
             throw new phpMorphy_Exception("Can`t convert '{$string}' " . $this->getEncoding() . ' -> ' . $this->getInternalEncoding());
         }
         return $result;
     } else {
         return $string;
     }
 }
示例#26
0
 /**
  * Get next bunch of validatetd rows.
  *
  * @return array|null
  */
 public function getNextBunch()
 {
     if (null === $this->_iterator) {
         $this->_iterator = $this->getIterator();
         $this->_iterator->rewind();
     }
     if ($this->_iterator->valid()) {
         $dataRow = $this->_iterator->current();
         $dataRow = unserialize($dataRow[0]);
         $this->_iterator->next();
     } else {
         $this->_iterator = null;
         $dataRow = null;
     }
     return $dataRow;
 }
 /**
  * Get next bunch of validated rows.
  *
  * @return array|null
  */
 public function getNextBunch()
 {
     if (null === $this->_iterator) {
         $this->_iterator = $this->getIterator();
         $this->_iterator->rewind();
     }
     if ($this->_iterator->valid()) {
         $dataRow = $this->_iterator->current();
         $dataRow = Mage::helper('core')->jsonDecode($dataRow[0]);
         $this->_iterator->next();
     } else {
         $this->_iterator = null;
         $dataRow = null;
     }
     return $dataRow;
 }
示例#28
0
 public function current()
 {
     $row = parent::current();
     $result = [];
     foreach ($this->columns as $column) {
         $result[str_replace('a.', '', $column)] = $row->getValue($column);
     }
     $result['targetTitle'] = '';
     if (!empty($result['targetDocument']) && array_key_exists($result['targetDocument'], $this->targets)) {
         $result['targetTitle'] = $this->targets[$result['targetDocument']]['title'];
     }
     $result['domainParts'] = json_decode($result['domainParts'], true);
     $result['customUrl'] = $this->generator->generate($result['baseDomain'], $result['domainParts']);
     $result['creatorFullName'] = $this->userManager->getFullNameByUserId($result['creator']);
     $result['changerFullName'] = $this->userManager->getFullNameByUserId($result['changer']);
     return $result;
 }
 function current()
 {
     $line = trim(parent::current());
     $word = '';
     $flags = '';
     $morph = '';
     if (false !== ($pos = mb_strpos($line, "\t"))) {
         $morph = trim(mb_substr($line, $pos + 1));
         $line = rtrim(mb_substr($line, 0, $pos));
     }
     if (false !== ($pos = mb_strpos($line, '/'))) {
         $word = rtrim(mb_substr($line, 0, $pos));
         $flags = ltrim(mb_substr($line, $pos + 1));
     } else {
         $word = $line;
     }
     return array('word' => $word, 'flags' => $this->parseFlags($flags), 'morph' => $morph);
 }
示例#30
0
文件: Fields.php 项目: rafeca/Pinq
 /**
  * Filters each item in the iteration to only contain the configured
  * fields.
  *
  * @return array
  */
 public function current()
 {
     $itm = parent::current();
     $result = array();
     if (is_array($itm)) {
         foreach ($this->fields as $field) {
             $result[$field] = isset($itm[$field]) ? $itm[$field] : null;
         }
     } else {
         if (is_object($itm)) {
             foreach ($this->fields as $field) {
                 $result[$field] = isset($itm->{$field}) ? $itm->{$field} : null;
             }
         } else {
             foreach ($this->fields as $field) {
                 $result[$field] = null;
             }
         }
     }
     return $result;
 }