1 | <?php namespace Cornford\Setter; |
||
6 | class Setting extends SettingBase implements SettableInterface { |
||
7 | |||
8 | /** |
||
9 | * Set a setting by key and value |
||
10 | * |
||
11 | * @param string $key |
||
12 | * @param string $value |
||
13 | * |
||
14 | * @return boolean |
||
15 | */ |
||
16 | public function set($key, $value) |
||
34 | |||
35 | /** |
||
36 | * Get a setting by key, optionally set a default or fallback to config lookup |
||
37 | * |
||
38 | * @param string $key |
||
39 | * @param string $default |
||
40 | * |
||
41 | * @return string|array|boolean |
||
42 | */ |
||
43 | public function get($key, $default = null) |
||
69 | |||
70 | /** |
||
71 | * Forget a setting by key |
||
72 | * |
||
73 | * @param string $key |
||
74 | * |
||
75 | * @return boolean |
||
76 | */ |
||
77 | public function forget($key) |
||
89 | |||
90 | /** |
||
91 | * Check a setting exists by key |
||
92 | * |
||
93 | * @param string $key |
||
94 | * |
||
95 | * @return boolean |
||
96 | */ |
||
97 | public function has($key) |
||
111 | |||
112 | /** |
||
113 | * Get all stored settings |
||
114 | * |
||
115 | * @return array |
||
116 | */ |
||
117 | public function all() |
||
125 | |||
126 | /** |
||
127 | * Clear all stored settings |
||
128 | * |
||
129 | * @return boolean |
||
130 | */ |
||
131 | public function clear() |
||
141 | |||
142 | /** |
||
143 | * Set the cache expiry |
||
144 | * |
||
145 | * @param boolean|integer|datetime $expiry |
||
146 | * |
||
147 | * @throws SettingVariableException |
||
148 | * |
||
149 | * @return self |
||
150 | */ |
||
151 | public function expires($expiry) |
||
161 | |||
162 | } |
||
163 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: