| @@ 195-210 (lines=16) @@ | ||
| 192 | * |
|
| 193 | * @return \M1\Vars\Cache\CacheProvider |
|
| 194 | */ |
|
| 195 | public function setPath($path) |
|
| 196 | { |
|
| 197 | if (is_null($path)) { |
|
| 198 | return; |
|
| 199 | } |
|
| 200 | ||
| 201 | if (!is_dir($path) || !is_writable($path)) { |
|
| 202 | throw new \InvalidArgumentException(sprintf( |
|
| 203 | "'%s' cache path does not exist or is not writable", |
|
| 204 | $path |
|
| 205 | )); |
|
| 206 | } |
|
| 207 | ||
| 208 | $this->path = realpath($path); |
|
| 209 | return $this; |
|
| 210 | } |
|
| 211 | ||
| 212 | /** |
|
| 213 | * Returns how long the cache lasts for |
|
| @@ 269-284 (lines=16) @@ | ||
| 266 | * |
|
| 267 | * @return \M1\Vars\Vars |
|
| 268 | */ |
|
| 269 | public function setBasePath($base_path) |
|
| 270 | { |
|
| 271 | if (is_null($base_path)) { |
|
| 272 | return; |
|
| 273 | } |
|
| 274 | ||
| 275 | if (!is_dir($base_path)) { |
|
| 276 | throw new \InvalidArgumentException(sprintf( |
|
| 277 | "'%s' base path does not exist or is not writable", |
|
| 278 | $base_path |
|
| 279 | )); |
|
| 280 | } |
|
| 281 | ||
| 282 | $this->base_path = realpath($base_path); |
|
| 283 | return $this; |
|
| 284 | } |
|
| 285 | ||
| 286 | /** |
|
| 287 | * Adds a resource to $this->resources |
|