Total Complexity | 12 |
Total Lines | 89 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | class C |
||
17 | { |
||
18 | /** |
||
19 | * 断言扩展,未加载则抛错 |
||
20 | * |
||
21 | * @param string $extension 扩展名 |
||
22 | * @param string $message |
||
23 | * |
||
24 | * @return void |
||
25 | */ |
||
26 | 15 | public static function assertExtension($extension, $message) |
|
27 | { |
||
28 | 15 | if (false === extension_loaded($extension)) { |
|
29 | 1 | throw new Exception($message); |
|
30 | } |
||
31 | 14 | } |
|
32 | |||
33 | /** |
||
34 | * 断言函数,不存在则抛错 |
||
35 | * |
||
36 | * @param string $function |
||
37 | * @param string $message |
||
38 | * |
||
39 | * @return void |
||
40 | */ |
||
41 | 1 | public static function assertFunction($function, $message) |
|
42 | { |
||
43 | 1 | if (false === function_exists($function)) { |
|
44 | 1 | throw new Exception($message); |
|
45 | } |
||
46 | 1 | } |
|
47 | |||
48 | /** |
||
49 | * 断言真,不为真则抛错 |
||
50 | * |
||
51 | * @param boolean $isTrue |
||
52 | * @param string $message |
||
53 | * |
||
54 | * @return void |
||
55 | */ |
||
56 | 8 | public static function assertTrue($isTrue, $message) |
|
60 | } |
||
61 | 8 | } |
|
62 | |||
63 | /** |
||
64 | * 断言非真,为真则抛错 |
||
65 | * |
||
66 | * @param boolean $isTrue |
||
67 | * @param string $message |
||
68 | * |
||
69 | * @return void |
||
70 | */ |
||
71 | 8 | public static function assertNotTrue($isNotTrue, $message) |
|
72 | { |
||
73 | 8 | if (true === $isNotTrue) { |
|
74 | 2 | throw new Exception($message); |
|
75 | } |
||
76 | 8 | } |
|
77 | |||
78 | /** |
||
79 | * 断言假,不为假则抛错 |
||
80 | * |
||
81 | * @param boolean $isTrue |
||
82 | * @param string $message |
||
83 | * |
||
84 | * @return void |
||
85 | */ |
||
86 | 2 | public static function assertFalse($isFalse, $message) |
|
90 | } |
||
91 | 2 | } |
|
92 | |||
93 | /** |
||
94 | * 断言非假,为假则抛错 |
||
95 | * |
||
96 | * @param boolean $isTrue |
||
97 | * @param string $message |
||
98 | * |
||
99 | * @return void |
||
100 | */ |
||
101 | 1 | public static function assertNotFalse($isNotFalse, $message) |
|
108 |