本文整理匯總了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;
}
示例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;
}
示例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);
}
示例4: key
public function key()
{
return "pre:" . parent::key();
}
示例5: current
public function current()
{
$iterator = $this->getInnerIterator();
$callback = $this->callback;
return $callback(parent::current(), parent::key(), $iterator);
}
示例6: current
function current()
{
return $this->transformItem(parent::current(), parent::key());
}
示例7: key
public function key()
{
return (string) parent::key();
}
示例8: current
public function current()
{
return call_user_func($this->callback, parent::current(), parent::key());
}
示例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());
}
示例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());
示例11: current
public function current()
{
return new TokenRow($this->tokenProcessor, parent::key());
}
示例12: key
public function key()
{
echo $this->key . ') ' . __METHOD__ . PHP_EOL;
return parent::key();
}
示例13: current
public function current()
{
return parent::key();
}
示例14:
__construct(\Traversable$iterator,$callback){parent::__construct($iterator);$this->callback=callback($callback);}function
current(){return$this->callback->invoke(parent::current(),parent::key());}}class
示例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);
}
}