blob: b8f2895fd5e97c17e031ff2ea504acaf997944be (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
<?php
namespace MediaWiki\Notification;
use ArrayIterator;
use IteratorAggregate;
use MediaWiki\User\UserIdentity;
use Wikimedia\Assert\Assert;
/**
* @since 1.44
* @unstable
*/
class RecipientSet implements IteratorAggregate {
/**
* @var UserIdentity[]
*/
private array $recipients;
/**
* @param UserIdentity|UserIdentity[] $recipients
*/
public function __construct( $recipients ) {
if ( !is_array( $recipients ) ) {
$recipients = [ $recipients ];
}
Assert::parameterElementType( UserIdentity::class, $recipients, '$recipients' );
$this->recipients = $recipients;
}
/** @return UserIdentity[] */
public function getRecipients(): array {
return $this->recipients;
}
public function getIterator(): ArrayIterator {
return new ArrayIterator( $this->recipients );
}
}
|