17 lines
419 B
PHP
17 lines
419 B
PHP
<?php
|
|||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
final class ReportAudience
|
||
|
|
{
|
||
|
|
public const CLIENT = 'client';
|
||
|
|
public const INTERNAL = 'internal';
|
||
|
|
|
||
|
|
public static function validate(string $audience): string
|
||
|
|
{
|
||
|
|
if (!in_array($audience, [self::CLIENT, self::INTERNAL], true)) {
|
||
|
|
throw new InvalidArgumentException('Report audience must be client or internal.');
|
||
|
|
}
|
||
|
|
return $audience;
|
||
|
|
}
|
||
|
|
}
|