Created
July 19, 2016 13:58
-
-
Save Intrepidity/5ba649520f85b7f2758e44a9839f317b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function random_exception() | |
{ | |
foreach(get_declared_classes() as $class) { | |
$exceptions = []; | |
if (substr($class, -9) === 'Exception') { | |
$exceptions[] = $class; | |
} | |
$exception = $exceptions[array_rand($exceptions)]; | |
throw new $exception(); | |
} | |
} | |
random_exception(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment