| @@ 182-202 (lines=21) @@ | ||
| 179 | ); |
|
| 180 | } |
|
| 181 | ||
| 182 | public function xActivate(HttpResult $result) |
|
| 183 | { |
|
| 184 | ||
| 185 | if ($result->hasError()) { |
|
| 186 | $this->console->writeln('> MxKarma activation failure: $f00'.$result->getError()); |
|
| 187 | ||
| 188 | return; |
|
| 189 | } |
|
| 190 | ||
| 191 | $data = $this->getObject($result->getResponse()); |
|
| 192 | ||
| 193 | if ($data === null) { |
|
| 194 | return; |
|
| 195 | } |
|
| 196 | ||
| 197 | if ($data->activated) { |
|
| 198 | $this->connected = true; |
|
| 199 | $this->console->writeln('> MxKarma connection $0f0success!'); |
|
| 200 | $this->dispatcher->dispatch(self::EVENT_CONNECT, []); |
|
| 201 | } |
|
| 202 | } |
|
| 203 | ||
| 204 | /** |
|
| 205 | * loads votes from server |
|
| @@ 274-289 (lines=16) @@ | ||
| 271 | /** |
|
| 272 | * @param HttpResult $result |
|
| 273 | */ |
|
| 274 | public function xSaveVotes(HttpResult $result) |
|
| 275 | { |
|
| 276 | ||
| 277 | if ($result->hasError()) { |
|
| 278 | $this->console->writeln('> MxKarma save votes failure: $f00'.$result->getError()); |
|
| 279 | ||
| 280 | return; |
|
| 281 | } |
|
| 282 | ||
| 283 | $data = $this->getObject($result->getResponse()); |
|
| 284 | ||
| 285 | if ($data === null) { |
|
| 286 | return; |
|
| 287 | } |
|
| 288 | $this->console->writeln('> MxKarma save votes $0f0success!'); |
|
| 289 | $this->dispatcher->dispatch(self::EVENT_VOTESAVE, ["updated" => $data->updated]); |
|
| 290 | } |
|
| 291 | ||
| 292 | /** |
|