Total Complexity | 3 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class HashidsDriver implements DriverInterface |
||
9 | { |
||
10 | /** |
||
11 | * The Hashids instance. |
||
12 | * |
||
13 | * @var \Hashids\Hashids |
||
14 | */ |
||
15 | protected $hashids; |
||
16 | |||
17 | /** |
||
18 | * Create a new Hashids driver instance. |
||
19 | * |
||
20 | * @param array $config |
||
21 | */ |
||
22 | 8 | public function __construct(array $config = []) |
|
23 | { |
||
24 | 8 | $this->hashids = new Hashids( |
|
25 | 8 | Arr::get($config, 'salt', ''), |
|
26 | 8 | Arr::get($config, 'min_length', 0), |
|
27 | 8 | Arr::get($config, 'alphabet', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890') |
|
28 | 4 | ); |
|
29 | 4 | } |
|
30 | |||
31 | /** |
||
32 | * Encode the data. |
||
33 | * |
||
34 | * @param mixed $data |
||
35 | * @return string |
||
36 | */ |
||
37 | 4 | public function encode($data) |
|
40 | } |
||
41 | |||
42 | /** |
||
43 | * Decode the data. |
||
44 | * |
||
45 | * @param mixed $data |
||
46 | * @return mixed |
||
47 | */ |
||
48 | 4 | public function decode($data) |
|
53 |