* The return value is cast to an integer. */ public function count(): int { return (int)$this->data['message-count']; } /** * (PHP 5 >= 5.0.0) * Return the current element * * @link http://php.net/manual/en/iterator.current.php */ public function current(): Message { if (!isset($this->messages[$this->position])) { $this->messages[$this->position] = new Message($this->data['messages'][$this->position]); } return $this->messages[$this->position]; } /** * (PHP 5 >= 5.0.0) * Move forward to next element * * @link http://php.net/manual/en/iterator.next.php */ public function next(): void { $this->position++; } /** * (PHP 5 >= 5.0.0) * Return the key of the current element * * @link http://php.net/manual/en/iterator.key.php */ public function key(): int { return $this->position; } /** * (PHP 5 >= 5.0.0) * Checks if current position is valid * * @link http://php.net/manual/en/iterator.valid.php * Returns true on success or false on failure. */ public function valid(): bool { return isset($this->data['messages'][$this->position]); } /** * (PHP 5 >= 5.0.0) * Rewind the Iterator to the first element * * @link http://php.net/manual/en/iterator.rewind.php */ public function rewind(): void { $this->position = 0; } public function toArray(): array { return $this->data; } }