2011-08-25 22:53:05 -05:00
|
|
|
<?php namespace Laravel\Security\Hashing;
|
2011-08-23 21:04:40 -05:00
|
|
|
|
|
|
|
|
class Hasher {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The hashing engine being used to perform the hashing.
|
|
|
|
|
*
|
|
|
|
|
* @var Hash\Engine
|
|
|
|
|
*/
|
2011-09-06 22:04:52 -05:00
|
|
|
protected $engine;
|
2011-08-23 21:04:40 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new Hasher instance.
|
|
|
|
|
*
|
2011-08-25 22:53:05 -05:00
|
|
|
* @param Engine $engine
|
2011-08-23 21:04:40 -05:00
|
|
|
* @return void
|
|
|
|
|
*/
|
2011-09-06 22:04:52 -05:00
|
|
|
public function __construct(Engine $engine)
|
2011-08-23 21:04:40 -05:00
|
|
|
{
|
2011-09-06 22:04:52 -05:00
|
|
|
$this->engine = $engine
|
2011-08-23 21:04:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Magic Method for delegating method calls to the hashing engine.
|
|
|
|
|
*/
|
|
|
|
|
public function __call($method, $parameters)
|
|
|
|
|
{
|
|
|
|
|
return call_user_func_array(array($this->engine, $method), $parameters);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Magic Method for performing methods on the default hashing engine.
|
|
|
|
|
*/
|
|
|
|
|
public static function __callStatic($method, $parameters)
|
|
|
|
|
{
|
|
|
|
|
return call_user_func_array(array(static::make()->engine, $method), $parameters);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|