本文整理汇总了PHP中Cake\Collection\Collection::valid方法的典型用法代码示例。如果您正苦于以下问题:PHP Collection::valid方法的具体用法?PHP Collection::valid怎么用?PHP Collection::valid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Collection\Collection
的用法示例。
在下文中一共展示了Collection::valid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: valid
/**
* Evaluates the condition and returns its result, this controls
* whether or not more results will be yielded.
*
* @return bool
*/
public function valid()
{
if (!parent::valid()) {
return false;
}
$current = $this->current();
$key = $this->key();
$condition = $this->_condition;
return !$condition($current, $key, $this->_innerIterator);
}
示例2: valid
/**
* 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: rewind
/**
* Resets the collection pointer.
*
* @return void
*/
public function rewind()
{
parent::rewind();
$this->_values->rewind();
$this->_validValues = $this->_values->valid();
}