Cryptography class.
Protected constructor since this is a static class.
NULL
protected function __construct()
{
// Nothing here
}
Returns an instance of the requested encryption configuration.
| Type | Description |
|---|---|
| string | (optional) Encryption configuration name |
mako\crypto\Adapter
public static function factory($name = null)
{
$config = Config::get('crypto');
$name = ($name === null) ? $config['default'] : $name;
if(isset($config['configurations'][$name]) === false)
{
throw new RuntimeException(vsprintf("%s(): '%s' has not been defined in the crypto configuration.", array(__METHOD__, $name)));
}
$class = '\mako\crypto\\' . $config['configurations'][$name]['library'];
return new $class($config['configurations'][$name]);
}
Magic shortcut to the default crypto configuration.
| Type | Description |
|---|---|
| string | Method name |
| array | Method arguments |
mixed
public static function __callStatic($name, $arguments)
{
return call_user_func_array(array(static::factory(), $name), $arguments);
}