Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
recepientcollection.php
1<?php
2
4
5class RecepientCollection implements \Iterator, \Countable
6{
8 private array $recepients;
9
10 public function __construct(Recepient ...$recepients)
11 {
12 $this->recepients = $recepients;
13 }
14
15 public function add(Recepient $recepient): void
16 {
17 $this->recepients[] = $recepient;
18 }
19
20 public function count(): int
21 {
22 return count($this->recepients);
23 }
24
25 public function current(): Recepient
26 {
27 return current($this->recepients);
28 }
29
30 public function next(): void
31 {
32 next($this->recepients);
33 }
34
35 public function key(): mixed
36 {
37 return key($this->recepients);
38 }
39
40 public function valid(): bool
41 {
42 $key = key($this->recepients);
43 return ($key !== null && $key !== false);
44 }
45
46 public function rewind(): void
47 {
48 reset($this->recepients);
49 }
50}