1 | <?php namespace Cornford\Setter; |
||
8 | class Setting extends SettingBase implements SettableInterface, CacheableInterface { |
||
9 | |||
10 | /** |
||
11 | * Set a setting by key and value |
||
12 | * |
||
13 | * @param string $key |
||
14 | * @param string $value |
||
15 | * |
||
16 | * @return boolean |
||
17 | */ |
||
18 | public function set($key, $value) |
||
38 | |||
39 | /** |
||
40 | * Get a setting by key, optionally set a default or fallback to config lookup |
||
41 | * |
||
42 | * @param string $key |
||
43 | * @param string $default |
||
44 | * |
||
45 | * @return string|array|boolean |
||
46 | */ |
||
47 | public function get($key, $default = null) |
||
75 | |||
76 | /** |
||
77 | * Forget a setting by key |
||
78 | * |
||
79 | * @param string $key |
||
80 | * |
||
81 | * @return boolean |
||
82 | */ |
||
83 | public function forget($key) |
||
97 | |||
98 | /** |
||
99 | * Check a setting exists by key |
||
100 | * |
||
101 | * @param string $key |
||
102 | * |
||
103 | * @return boolean |
||
104 | */ |
||
105 | public function has($key) |
||
119 | |||
120 | /** |
||
121 | * Get all stored settings |
||
122 | * |
||
123 | * @return array |
||
124 | */ |
||
125 | public function all() |
||
133 | |||
134 | /** |
||
135 | * Clear all stored settings |
||
136 | * |
||
137 | * @return boolean |
||
138 | */ |
||
139 | public function clear() |
||
151 | |||
152 | /** |
||
153 | * Set the expiry |
||
154 | * |
||
155 | * @param boolean|integer|Datetime $expiry |
||
156 | * |
||
157 | * @throws SettingArgumentException |
||
158 | * |
||
159 | * @return self |
||
160 | */ |
||
161 | public function expires($expiry) |
||
167 | |||
168 | /** |
||
169 | * Enable caching. |
||
170 | * |
||
171 | * @return self |
||
172 | */ |
||
173 | public function enableCache() |
||
179 | |||
180 | /** |
||
181 | * Disable caching. |
||
182 | * |
||
183 | * @return self |
||
184 | */ |
||
185 | public function disableCache() |
||
191 | |||
192 | /** |
||
193 | * Sets the uncached flag to request an item from the DB and re-cache the item. |
||
194 | * |
||
195 | * @return self |
||
196 | */ |
||
197 | public function uncached() |
||
203 | |||
204 | /** |
||
205 | * Set the cache expiry |
||
206 | * |
||
207 | * @param boolean|integer|Datetime $expiry |
||
208 | * |
||
209 | * @throws SettingArgumentException |
||
210 | * |
||
211 | * @return self |
||
212 | */ |
||
213 | public function cacheExpires($expiry) |
||
219 | |||
220 | } |
||
221 |