Random: replace user_error with exception

This commit is contained in:
terrafrost 2015-07-18 00:50:59 -05:00
parent 0565700461
commit 081f2cb825

View File

@ -49,6 +49,7 @@ class Random
* eg. for RSA key generation. * eg. for RSA key generation.
* *
* @param Integer $length * @param Integer $length
* @throws \RuntimeException if a symmetric cipher is needed but not loaded
* @return String * @return String
*/ */
public static function string($length) public static function string($length)
@ -199,8 +200,7 @@ class Random
$crypto = new RC4(); $crypto = new RC4();
break; break;
default: default:
user_error(__CLASS__ . ' requires at least one symmetric cipher be loaded'); throw new \RuntimeException(__CLASS__ . ' requires at least one symmetric cipher be loaded');
return false;
} }
$crypto->setKey($key); $crypto->setKey($key);