| @@ 230-253 (lines=24) @@ | ||
| 227 | * @param $name |
|
| 228 | * @return bool |
|
| 229 | */ |
|
| 230 | public function addWatchedFunction($name) |
|
| 231 | { |
|
| 232 | ||
| 233 | $name = trim($name); |
|
| 234 | if (empty($name)) { |
|
| 235 | return false; |
|
| 236 | } |
|
| 237 | ||
| 238 | try { |
|
| 239 | $id = new \MongoId(); |
|
| 240 | ||
| 241 | $data = [ |
|
| 242 | '_id' => $id, |
|
| 243 | 'name' => $name |
|
| 244 | ]; |
|
| 245 | $this->getConnection()->watches->insert($data); |
|
| 246 | ||
| 247 | return true; |
|
| 248 | } catch (\Exception $e) { |
|
| 249 | // if something goes wrong just ignore for now |
|
| 250 | // @todo add exception |
|
| 251 | } |
|
| 252 | return false; |
|
| 253 | } |
|
| 254 | ||
| 255 | /** |
|
| 256 | * @inheritDoc |
|
| @@ 261-281 (lines=21) @@ | ||
| 258 | * @param $name |
|
| 259 | * @return bool |
|
| 260 | */ |
|
| 261 | public function updateWatchedFunction($id, $name) |
|
| 262 | { |
|
| 263 | $name = trim($name); |
|
| 264 | if (empty($name)) { |
|
| 265 | return false; |
|
| 266 | } |
|
| 267 | ||
| 268 | try { |
|
| 269 | $id = new \MongoId($id); |
|
| 270 | $data = [ |
|
| 271 | '_id' => $id, |
|
| 272 | 'name' => $name |
|
| 273 | ]; |
|
| 274 | $this->getConnection()->watches->save($data); |
|
| 275 | ||
| 276 | return true; |
|
| 277 | } catch (\Exception $e) { |
|
| 278 | } |
|
| 279 | ||
| 280 | return false; |
|
| 281 | } |
|
| 282 | ||
| 283 | /** |
|
| 284 | * @inheritDoc |
|