@@ -23,7 +23,7 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | public function register() |
| 25 | 25 | { |
| 26 | - $this->app->singleton('md5hash',function (){ |
|
| 26 | + $this->app->singleton('md5hash', function() { |
|
| 27 | 27 | return new MD5Hasher(); |
| 28 | 28 | }); |
| 29 | 29 | } |
@@ -4,13 +4,13 @@ |
||
| 4 | 4 | class MD5Hasher |
| 5 | 5 | { |
| 6 | 6 | //对参数设置默认值,可以在不给出参数值时也能让函数通过 |
| 7 | - public function make($value,array $options = []){ |
|
| 7 | + public function make($value, array $options = []) { |
|
| 8 | 8 | $salt = isset($options['salt']) ? $options['salt'] : ''; |
| 9 | - return hash('md5',$value.$salt); |
|
| 9 | + return hash('md5', $value.$salt); |
|
| 10 | 10 | } |
| 11 | - public function check($value,$hashValue,array $options=[]){ |
|
| 11 | + public function check($value, $hashValue, array $options = []) { |
|
| 12 | 12 | $salt = isset($options['salt']) ? $options['salt'] : ''; |
| 13 | - return hash('md5',$value.$salt) === $hashValue; |
|
| 13 | + return hash('md5', $value.$salt) === $hashValue; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | } |
| 17 | 17 | \ No newline at end of file |