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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
<?php
declare(strict_types=1);
namespace StellarWP\FieldConditions;
use InvalidArgumentException;
/** * Sets up the Field Condition library. It currently only provides an optional means of replacing an exception. * * @since 1.0.0 */ class Config { /** * @var class-string<InvalidArgumentException> */ private static $invalidArgumentExceptionClass = InvalidArgumentException::class;
/** * @since 1.0.0 * * @throws InvalidArgumentException */ public static function throwInvalidArgumentException() { throw new self::$invalidArgumentExceptionClass(...func_get_args()); }
/** * @since 1.0.0 * * @return class-string<InvalidArgumentException> */ public static function getInvalidArgumentExceptionClass(): string { return self::$invalidArgumentExceptionClass; }
/** * @since 1.0.0 * * @param class-string<InvalidArgumentException> $invalidArgumentExceptionClass */ public static function setInvalidArgumentExceptionClass(string $invalidArgumentExceptionClass) { if (!is_a($invalidArgumentExceptionClass, InvalidArgumentException::class, true)) { throw new RuntimeException( 'The invalid argument exception class must extend the InvalidArgumentException' ); }
self::$invalidArgumentExceptionClass = $invalidArgumentExceptionClass; } }
|