| @@ 41-60 (lines=20) @@ | ||
| 38 | $this->remove("events/$event/$this->service"); |
|
| 39 | } |
|
| 40 | ||
| 41 | private function store($path, $value = null) |
|
| 42 | { |
|
| 43 | $chain = explode('/', $path); |
|
| 44 | ||
| 45 | $key = array_pop($chain); |
|
| 46 | $folder = implode('/', $chain); |
|
| 47 | ||
| 48 | $this->client->setRoot($folder); |
|
| 49 | try { |
|
| 50 | $this->client->ls('.'); |
|
| 51 | } catch(Exception $e) { |
|
| 52 | $this->client->mkdir('.'); |
|
| 53 | } |
|
| 54 | ||
| 55 | try { |
|
| 56 | $this->client->get($key); |
|
| 57 | } catch(Exception $e) { |
|
| 58 | $this->client->set($key, $value); |
|
| 59 | } |
|
| 60 | } |
|
| 61 | ||
| 62 | private function remove($path) |
|
| 63 | { |
|
| @@ 62-80 (lines=19) @@ | ||
| 59 | } |
|
| 60 | } |
|
| 61 | ||
| 62 | private function remove($path) |
|
| 63 | { |
|
| 64 | $chain = explode('/', $path); |
|
| 65 | ||
| 66 | $key = array_pop($chain); |
|
| 67 | $folder = implode('/', $chain); |
|
| 68 | ||
| 69 | $this->client->setRoot($folder); |
|
| 70 | try { |
|
| 71 | $this->client->ls('.'); |
|
| 72 | } catch(Exception $e) { |
|
| 73 | $this->client->mkdir('.'); |
|
| 74 | } |
|
| 75 | ||
| 76 | try { |
|
| 77 | $this->client->remove($key); |
|
| 78 | } catch(Exception $e) { |
|
| 79 | } |
|
| 80 | } |
|
| 81 | } |
|
| 82 | ||