| @@ 73-79 (lines=7) @@ | ||
| 70 | $msg->setHandled(true); |
|
| 71 | } |
|
| 72 | ||
| 73 | public function reserveForever(Message $msg, array $matches) |
|
| 74 | { |
|
| 75 | $key = $matches['resource']; |
|
| 76 | $results = $this->placeReservation($msg, $key, $this->resources->forever()); |
|
| 77 | $msg->reply(implode("\n", $results)); |
|
| 78 | $msg->setHandled(true); |
|
| 79 | } |
|
| 80 | ||
| 81 | public function reserveUntil(Message $msg, array $matches) |
|
| 82 | { |
|
| @@ 101-107 (lines=7) @@ | ||
| 98 | $this->release($msg, $matches, true); |
|
| 99 | } |
|
| 100 | ||
| 101 | public function release(Message $msg, array $matches, $please = false) |
|
| 102 | { |
|
| 103 | $key = $matches['resource']; |
|
| 104 | $results = $this->releaseReservation($msg, $key, $please); |
|
| 105 | $msg->reply(implode("\n", $results)); |
|
| 106 | $msg->setHandled(true); |
|
| 107 | } |
|
| 108 | ||
| 109 | public function releaseMine(Message $msg, array $matches) |
|
| 110 | { |
|
| @@ 122-130 (lines=9) @@ | ||
| 119 | $msg->setHandled(true); |
|
| 120 | } |
|
| 121 | ||
| 122 | public function releaseAll(Message $msg, array $matches) |
|
| 123 | { |
|
| 124 | $results = []; |
|
| 125 | foreach ($this->resources->getKeys() as $key) { |
|
| 126 | $results = array_merge($results, $this->releaseReservation($msg, $key)); |
|
| 127 | } |
|
| 128 | $msg->reply(implode("\n", $results)); |
|
| 129 | $msg->setHandled(true); |
|
| 130 | } |
|
| 131 | ||
| 132 | public function list(Message $msg, array $matches) |
|
| 133 | { |
|
| @@ 152-162 (lines=11) @@ | ||
| 149 | $msg->setHandled(true); |
|
| 150 | } |
|
| 151 | ||
| 152 | public function listFree(Message $msg, array $matches) |
|
| 153 | { |
|
| 154 | $results = []; |
|
| 155 | foreach ($this->resources->getAll() as $key => $resource) { |
|
| 156 | if (empty($resource)) { |
|
| 157 | $results[] = $key; |
|
| 158 | } |
|
| 159 | } |
|
| 160 | $msg->reply(implode(',', $results)); |
|
| 161 | $msg->setHandled(true); |
|
| 162 | } |
|
| 163 | ||
| 164 | public function isFree(Message $msg, array $matches) |
|
| 165 | { |
|