1 <?php |
1 <?php |
2 /** |
2 /** |
3 * Random_* Compatibility Library |
3 * Random_* Compatibility Library |
4 * for using the new PHP 7 random_* API in PHP 5 projects |
4 * for using the new PHP 7 random_* API in PHP 5 projects |
5 * |
5 * |
6 * The MIT License (MIT) |
6 * The MIT License (MIT) |
7 * |
7 * |
8 * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises |
8 * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises |
9 * |
9 * |
10 * Permission is hereby granted, free of charge, to any person obtaining a copy |
10 * Permission is hereby granted, free of charge, to any person obtaining a copy |
11 * of this software and associated documentation files (the "Software"), to deal |
11 * of this software and associated documentation files (the "Software"), to deal |
12 * in the Software without restriction, including without limitation the rights |
12 * in the Software without restriction, including without limitation the rights |
13 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
13 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
14 * copies of the Software, and to permit persons to whom the Software is |
14 * copies of the Software, and to permit persons to whom the Software is |
28 |
28 |
29 if (!class_exists('Error', false)) { |
29 if (!class_exists('Error', false)) { |
30 // We can't really avoid making this extend Exception in PHP 5. |
30 // We can't really avoid making this extend Exception in PHP 5. |
31 class Error extends Exception |
31 class Error extends Exception |
32 { |
32 { |
33 |
33 |
34 } |
34 } |
35 } |
35 } |
36 |
36 |
37 if (!class_exists('TypeError', false)) { |
37 if (!class_exists('TypeError', false)) { |
38 if (is_subclass_of('Error', 'Exception')) { |
38 if (is_subclass_of('Error', 'Exception')) { |
39 class TypeError extends Error |
39 class TypeError extends Error |
40 { |
40 { |
41 |
41 |
42 } |
42 } |
43 } else { |
43 } else { |
44 class TypeError extends Exception |
44 class TypeError extends Exception |
45 { |
45 { |
46 |
46 |
47 } |
47 } |
48 } |
48 } |
49 } |
49 } |