當前位置: 首頁>>代碼示例>>PHP>>正文


PHP IteratorIterator::valid方法代碼示例

本文整理匯總了PHP中IteratorIterator::valid方法的典型用法代碼示例。如果您正苦於以下問題:PHP IteratorIterator::valid方法的具體用法?PHP IteratorIterator::valid怎麽用?PHP IteratorIterator::valid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在IteratorIterator的用法示例。


在下文中一共展示了IteratorIterator::valid方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: valid

 public function valid()
 {
     if (!parent::valid()) {
         return false;
     }
     return $this->range->contains($this->current()->getKey());
 }
開發者ID:malkusch,項目名稱:php-index,代碼行數:7,代碼來源:RangeIterator.php

示例2: next

 public function next()
 {
     $this->chunk = array();
     for ($i = 0; $i < $this->chunkSize && parent::valid(); $i++) {
         $this->chunk[] = parent::current();
         parent::next();
     }
 }
開發者ID:jorjoh,項目名稱:Varden,代碼行數:8,代碼來源:ChunkedIterator.php

示例3: next

 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;
 }
開發者ID:arduanov,項目名稱:pipes,代碼行數:9,代碼來源:ChunkIterator.php

示例4: findChangelog

 /**
  * @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();
 }
開發者ID:nochso,項目名稱:writeme,代碼行數:17,代碼來源:Changelog.php

示例5: valid

 public function valid()
 {
     if (!parent::valid()) {
         return false;
     }
     if ($aKey = FsKey::createKey(parent::current())) {
         $this->aCurrentKey = $aKey;
         return true;
     } else {
         return false;
     }
 }
開發者ID:JeCat,項目名稱:framework,代碼行數:12,代碼來源:FsKeyIterator.php

示例6: getNextBunch

 /**
  * 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;
 }
開發者ID:barneydesmond,項目名稱:propitious-octo-tribble,代碼行數:21,代碼來源:Data.php

示例7: getNextBunch

 /**
  * 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;
 }
開發者ID:votanlean,項目名稱:Magento-Pruebas,代碼行數:21,代碼來源:Data.php

示例8: valid

 /**
  * Returns whether the current element is valid or not (as required by the
  * Iterator interface).
  *
  * @return bool true if the current element is valid; false otherwise
  */
 public function valid()
 {
     return $this->iterator->valid();
 }
開發者ID:sensorsix,項目名稱:app,代碼行數:10,代碼來源:sfOutputEscaperIteratorDecorator.class.php

示例9: valid

 public function valid()
 {
     echo $this->key . ') ' . __METHOD__ . PHP_EOL;
     return parent::valid();
 }
開發者ID:arduanov,項目名稱:pipes,代碼行數:5,代碼來源:TestIterator.php

示例10: valid

 public function valid()
 {
     return parent::valid() && $this->it2->valid();
 }
開發者ID:halfnelson,項目名稱:LINQ4PHP,代碼行數:4,代碼來源:ZipIterator.php

示例11: __construct

    {
        echo __METHOD__ . "({$name})\n";
    }
}
$stmt = $db->query($SELECT, PDO::FETCH_CLASS, 'Test', array('WOW'));
$it = new IteratorIterator($stmt);
/* check if we can convert that thing */
/*** HINT: If YOU plan to do so remember not to call rewind() -> see below ***/
foreach ($it as $data) {
    var_dump($data);
}
$it->next();
/* must be allowed */
var_dump($it->current());
/* must return NULL */
var_dump($it->valid());
/* must return false */
class PDOStatementAggregate extends PDOStatement implements IteratorAggregate
{
    private function __construct()
    {
        echo __METHOD__ . "\n";
        $this->setFetchMode(PDO::FETCH_NUM);
        /* default fetch mode is BOTH, so we see if the ctor can overwrite that */
    }
    function getIterator()
    {
        echo __METHOD__ . "\n";
        $this->execute();
        return new IteratorIterator($this, 'PDOStatement');
    }
開發者ID:gleamingthecube,項目名稱:php,代碼行數:31,代碼來源:ext_pdo_tests_pdo_014.php

示例12: valid

 /**
  * Returns whether the iterator currently has a valid value
  *
  * @return Boolean
  */
 public function valid()
 {
     $this->dumpStart(__FUNCTION__);
     $result = parent::valid();
     $this->dumpEnd(__FUNCTION__, $result);
     return $result;
 }
開發者ID:Nycto,項目名稱:Round-Eights,代碼行數:12,代碼來源:Debug.php

示例13: next

 /**
  * Move to next element
  */
 public function next()
 {
     parent::next();
     ++$this->count;
     if (parent::valid()) {
         $this->advanceWindow();
     }
 }
開發者ID:xphere,項目名稱:lazzzy,代碼行數:11,代碼來源:WindowIterator.php


注:本文中的IteratorIterator::valid方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。