1
<?php
2

3
declare(strict_types=1);
4

5
namespace Kreait\Firebase\Messaging;
6

7
use Countable;
8
use IteratorAggregate;
9
use Traversable;
10

11
/**
12
 * @implements IteratorAggregate<Message>
13
 */
14
final class Messages implements Countable, IteratorAggregate
15
{
16
    /** @var Message[] */
17
    private $messages;
18

19 12
    public function __construct(Message ...$messages)
20
    {
21 12
        $this->messages = $messages;
22
    }
23

24
    /**
25
     * @codeCoverageIgnore
26
     *
27
     * @return Traversable<Message>|Message[]
28
     */
29
    public function getIterator()
30
    {
31
        yield from $this->messages;
32
    }
33

34 12
    public function count(): int
35
    {
36 12
        return \count($this->messages);
37
    }
38
}

Read our documentation on viewing source code .

Loading