| 1 | <?php |
||
| 22 | class MessageBag implements JsonSerializable, IteratorAggregate, Countable |
||
| 23 | { |
||
| 24 | /** |
||
| 25 | * @var Message[] |
||
| 26 | */ |
||
| 27 | private $messages = []; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Adds a message to the message bag. |
||
| 31 | */ |
||
| 32 | public function add(Message $message): void |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Returns all messages. |
||
| 39 | * |
||
| 40 | * @return Message[] |
||
| 41 | */ |
||
| 42 | public function all(): array |
||
| 46 | |||
| 47 | /** |
||
| 48 | * {@inheritdoc} |
||
| 49 | */ |
||
| 50 | public function jsonSerialize(): array |
||
| 54 | |||
| 55 | /** |
||
| 56 | * {@inheritdoc} |
||
| 57 | */ |
||
| 58 | public function count(): int |
||
| 62 | |||
| 63 | /** |
||
| 64 | * {@inheritdoc} |
||
| 65 | */ |
||
| 66 | public function getIterator(): Traversable |
||
| 70 | } |
||
| 71 |