Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 3 |
DedupMailableFactory | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 3 |
__callStatic | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 3 |
1 | <?php |
2 | |
3 | namespace Qmp\Laravel\Deduplication\Mail; |
4 | |
5 | use Exception; |
6 | |
7 | class DedupMailableFactory |
8 | { |
9 | /** |
10 | * Undocumented variable |
11 | * |
12 | * @var array |
13 | */ |
14 | protected static $authorized = [ |
15 | 'inform' => DeduplicationInformMailable::class, |
16 | 'relaunch' => DeduplicationRelaunchMailable::class, |
17 | 'available' => DeduplicationAvailableMailable::class |
18 | ]; |
19 | |
20 | /** |
21 | * Undocumented function |
22 | * |
23 | * @param string $name |
24 | * @param mixed $arguments |
25 | * @return DeduplicationMailableBase |
26 | */ |
27 | public static function __callStatic($name, $arguments): DeduplicationMailableBase |
28 | { |
29 | if (in_array($name, array_keys(self::$authorized))) { |
30 | return new self::$authorized[$name]($arguments[0]); |
31 | } |
32 | |
33 | throw new Exception("$name does not exists ! Authorized values are " . implode(', ', self::$authorized) . '.'); |
34 | } |
35 | } |