lib: Introduce IcingaException::create()

refs #9644
This commit is contained in:
Eric Lippmann 2015-07-27 16:25:41 +02:00
parent 07fb82357b
commit 2c8235d486
1 changed files with 14 additions and 0 deletions

View File

@ -4,6 +4,7 @@
namespace Icinga\Exception;
use Exception;
use ReflectionClass;
class IcingaException extends Exception
{
@ -25,4 +26,17 @@ class IcingaException extends Exception
}
parent::__construct(vsprintf($message, $args), 0, $exc);
}
/**
* Create the exception from an array of arguments
*
* @param array $args
*
* @return static
*/
public static function create(array $args)
{
$e = new ReflectionClass(get_called_class());
return $e->newInstanceArgs($args);
}
}