1 | <?php namespace Arcanedev\Hasher; |
||
12 | class HashManager extends Manager implements HashManagerContract |
||
13 | { |
||
14 | /* ------------------------------------------------------------------------------------------------ |
||
15 | | Properties |
||
16 | | ------------------------------------------------------------------------------------------------ |
||
17 | */ |
||
18 | /** |
||
19 | * The driver connection. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $connection; |
||
24 | |||
25 | /* ------------------------------------------------------------------------------------------------ |
||
26 | | Constructor |
||
27 | | ------------------------------------------------------------------------------------------------ |
||
28 | */ |
||
29 | /** |
||
30 | * Create a new manager instance. |
||
31 | * |
||
32 | * @param \Illuminate\Foundation\Application $app |
||
33 | */ |
||
34 | public function __construct($app) |
||
40 | |||
41 | /* ------------------------------------------------------------------------------------------------ |
||
42 | | Getters & Setters |
||
43 | | ------------------------------------------------------------------------------------------------ |
||
44 | */ |
||
45 | /** |
||
46 | * Get the default driver name. |
||
47 | * |
||
48 | * @return string |
||
49 | */ |
||
50 | public function getDefaultDriver() |
||
54 | |||
55 | /** |
||
56 | * Get the default driver connection. |
||
57 | * |
||
58 | * @return string |
||
59 | */ |
||
60 | public function getDefaultConnection() |
||
66 | |||
67 | /** |
||
68 | * Set the hasher connection. |
||
69 | * |
||
70 | * @param string $connection |
||
71 | * |
||
72 | * @return \Arcanedev\Hasher\HashManager |
||
73 | */ |
||
74 | public function connection($connection = null) |
||
83 | |||
84 | /* ------------------------------------------------------------------------------------------------ |
||
85 | | Main Functions |
||
86 | | ------------------------------------------------------------------------------------------------ |
||
87 | */ |
||
88 | /** |
||
89 | * Get a driver instance. |
||
90 | * |
||
91 | * @param string $driver |
||
92 | * @param string|null $connection |
||
93 | * |
||
94 | * @return \Arcanedev\Hasher\Contracts\HashDriver |
||
95 | */ |
||
96 | public function with($connection = null, $driver = null) |
||
101 | |||
102 | /** |
||
103 | * Get a driver instance. |
||
104 | * |
||
105 | * @param string $driver |
||
106 | * |
||
107 | * @return \Arcanedev\Hasher\Contracts\HashDriver |
||
108 | */ |
||
109 | public function driver($driver = null) |
||
113 | |||
114 | /** |
||
115 | * Build all hash drivers. |
||
116 | */ |
||
117 | private function buildDrivers() |
||
125 | |||
126 | /** |
||
127 | * Build the driver. |
||
128 | * |
||
129 | * @param string $name |
||
130 | * @param string $class |
||
131 | * |
||
132 | * @return Contracts\HashDriver |
||
133 | */ |
||
134 | private function buildDriver($name, $class) |
||
143 | |||
144 | /** |
||
145 | * Encode the value. |
||
146 | * |
||
147 | * @param mixed $value |
||
148 | * |
||
149 | * @return string |
||
150 | */ |
||
151 | public function encode($value) |
||
155 | |||
156 | /** |
||
157 | * Decode the hashed value. |
||
158 | * |
||
159 | * @param string $hashed |
||
160 | * |
||
161 | * @return mixed |
||
162 | */ |
||
163 | public function decode($hashed) |
||
167 | |||
168 | /* ------------------------------------------------------------------------------------------------ |
||
169 | | Other Functions |
||
170 | | ------------------------------------------------------------------------------------------------ |
||
171 | */ |
||
172 | /** |
||
173 | * Get the hasher config. |
||
174 | * |
||
175 | * @param string $name |
||
176 | * @param mixed|null $default |
||
177 | * |
||
178 | * @return mixed |
||
179 | */ |
||
180 | protected function getHasherConfig($name, $default = null) |
||
184 | } |
||
185 |