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


PHP IteratorIterator::key方法代碼示例

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


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

示例1: key

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

示例2: key

 /**
  * returns the current key
  *
  * @return  mixed
  */
 public function key()
 {
     $key = parent::key();
     if (null !== $this->keyConsumer) {
         $consumeKey = $this->keyConsumer;
         $consumeKey($key);
     }
     return $key;
 }
開發者ID:stubbles,項目名稱:stubbles-sequence,代碼行數:14,代碼來源:Peek.php

示例3: current

 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);
 }
開發者ID:evilgeny,項目名稱:bob,代碼行數:9,代碼來源:MapIterator.class.php

示例4: key

 public function key()
 {
     return "pre:" . parent::key();
 }
開發者ID:jinliangzhou,項目名稱:Accumulate,代碼行數:4,代碼來源:outiterator.php

示例5: current

 public function current()
 {
     $iterator = $this->getInnerIterator();
     $callback = $this->callback;
     return $callback(parent::current(), parent::key(), $iterator);
 }
開發者ID:proophsoftware,項目名稱:done-process,代碼行數:6,代碼來源:MapIterator.php

示例6: current

 function current()
 {
     return $this->transformItem(parent::current(), parent::key());
 }
開發者ID:Sywooch,項目名稱:dump,代碼行數:4,代碼來源:iterators.php

示例7: key

 public function key()
 {
     return (string) parent::key();
 }
開發者ID:Dren-x,項目名稱:mobit,代碼行數:4,代碼來源:TemplateDirIterator.php

示例8: current

 public function current()
 {
     return call_user_func($this->callback, parent::current(), parent::key());
 }
開發者ID:jurasm2,項目名稱:nette,代碼行數:4,代碼來源:Mapper.php

示例9: key

 /**
  * returns the current key
  *
  * @return  mixed
  */
 public function key()
 {
     if (!$this->valid()) {
         return null;
     }
     if (null === $this->keyMapper) {
         return parent::key();
     }
     $map = $this->keyMapper;
     return $map(parent::key(), parent::current());
 }
開發者ID:stubbles,項目名稱:stubbles-sequence,代碼行數:16,代碼來源:MappingIterator.php

示例10: rewind

{
    public function rewind()
    {
    }
    public function next()
    {
    }
    public function valid()
    {
        return true;
    }
    public function current()
    {
        throw new Exception('boo');
    }
    public function key()
    {
    }
}
$it = new BlaIterator();
$itit = new IteratorIterator($it);
try {
    foreach ($itit as $key => $value) {
        echo $key, $value;
    }
} catch (Exception $e) {
    var_dump($e->getMessage());
}
var_dump($itit->current());
var_dump($itit->key());
開發者ID:badlamer,項目名稱:hhvm,代碼行數:30,代碼來源:bug42703.php

示例11: current

 public function current()
 {
     return new TokenRow($this->tokenProcessor, parent::key());
 }
開發者ID:kcristiano,項目名稱:civicrm-core,代碼行數:4,代碼來源:TokenProcessor.php

示例12: key

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

示例13: current

 public function current()
 {
     return parent::key();
 }
開發者ID:thumbtack,項目名稱:crankshaft,代碼行數:4,代碼來源:FlippingIterator.php

示例14:

__construct(\Traversable$iterator,$callback){parent::__construct($iterator);$this->callback=callback($callback);}function
current(){return$this->callback->invoke(parent::current(),parent::key());}}class
開發者ID:JanTvrdik,項目名稱:NetteExtras,代碼行數:2,代碼來源:loader.php

示例15: advanceWindow

 /**
  * Advances iterator, saving elements into the window
  * Keeps keys from iterable and removes first item if window grows too large
  */
 protected function advanceWindow()
 {
     $this->window[parent::key()] = parent::current();
     if (count($this->window) > $this->windowSize) {
         array_shift($this->window);
     }
 }
開發者ID:xphere,項目名稱:lazzzy,代碼行數:11,代碼來源:WindowIterator.php


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