Total Complexity | 8 |
Total Lines | 72 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | class ApplicationStorage { |
||
15 | /** |
||
16 | * @var array |
||
17 | */ |
||
18 | private static $datas; |
||
19 | |||
20 | /** |
||
21 | * Put a value in storage at key position. |
||
22 | * @param string $key |
||
23 | * @param mixed $value |
||
24 | */ |
||
25 | public static function put(string $key, $value){ |
||
|
|||
26 | self::$datas[$key=$value]; |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * Return a value by key. |
||
31 | * @param string $key |
||
32 | * @param mixed $default |
||
33 | * @return mixed |
||
34 | */ |
||
35 | public static function get(string $key,$default=null){ |
||
36 | return self::$datas[$key]??$default; |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * Return all keys in storage. |
||
41 | * @return array |
||
42 | */ |
||
43 | public static function getAllKeys(){ |
||
44 | return \array_keys(self::$datas); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Return all datas in storage. |
||
49 | * @return array |
||
50 | */ |
||
51 | public static function getAll(){ |
||
52 | return self::$datas; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Check if a key exists or not. |
||
57 | * @param string $key |
||
58 | * @return boolean |
||
59 | */ |
||
60 | public static function exists(string $key){ |
||
61 | return isset(self::$datas[$key]); |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * Search for a given value and returns the first corresponding key if successful. |
||
66 | * @param mixed $value |
||
67 | * @return string|boolean |
||
68 | */ |
||
69 | public static function search($value){ |
||
70 | return \array_search($value,self::$datas); |
||
71 | } |
||
72 | |||
73 | /** |
||
74 | * Clear all values in storage. |
||
75 | */ |
||
76 | public static function clear(){ |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * Remove a value by key. |
||
82 | * @param string $key |
||
83 | */ |
||
84 | public static function remove(string $key){ |
||
86 | } |
||
87 | } |
||
88 | |||
89 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.