WP_CLI\Iterators

Query::valid()publicWP-CLI 1.0

Method of the class: Query{}

No Hooks.

Return

null. Nothing (null).

Usage

$Query = new Query();
$Query->valid();

Query::valid() code WP-CLI 2.8.0-alpha

public function valid() {
	if ( $this->depleted ) {
		return false;
	}

	if ( ! isset( $this->results[ $this->index_in_results ] ) ) {
		$items_loaded = $this->load_items_from_db();

		if ( ! $items_loaded ) {
			$this->rewind();
			$this->depleted = true;
			return false;
		}

		$this->index_in_results = 0;
	}

	return true;
}