mako\Crypto


Description


Cryptography class.


Class methods


Toggle source

protected __construct()


Protected constructor since this is a static class.

Return value

NULL

protected function __construct()
{
	// Nothing here
}

Toggle source

public static factory($name = NULL)


Returns an instance of the requested encryption configuration.


Parameters

Type Description
string (optional) Encryption configuration name
Return value

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]);
}

Toggle source

public static __callStatic($name, $arguments)


Magic shortcut to the default crypto configuration.


Parameters

Type Description
string Method name
array Method arguments
Return value

mixed

public static function __callStatic($name, $arguments)
{
	return call_user_func_array(array(static::factory(), $name), $arguments);
}