| @@ 162-182 (lines=21) @@ | ||
| 159 | ); |
|
| 160 | } |
|
| 161 | ||
| 162 | public function xActivate(HttpResult $result) |
|
| 163 | { |
|
| 164 | ||
| 165 | if ($result->hasError()) { |
|
| 166 | $this->console->writeln('> MxKarma connection $f00 failure: '.$result->getError()); |
|
| 167 | return; |
|
| 168 | } |
|
| 169 | ||
| 170 | $data = $this->getObject($result->getResponse()); |
|
| 171 | ||
| 172 | if ($data === null) { |
|
| 173 | return; |
|
| 174 | } |
|
| 175 | ||
| 176 | if ($data->activated) { |
|
| 177 | $this->connected = true; |
|
| 178 | $this->console->writeln('> MxKarma connection $0f0success!'); |
|
| 179 | $this->dispatcher->dispatch(self::EVENT_CONNECT, []); |
|
| 180 | } |
|
| 181 | } |
|
| 182 | ||
| 183 | /** |
|
| 184 | * loads votes from server |
|
| 185 | * @param array $players |
|
| @@ 253-268 (lines=16) @@ | ||
| 250 | /** |
|
| 251 | * @param HttpResult $result |
|
| 252 | */ |
|
| 253 | public function xSaveVotes(HttpResult $result) |
|
| 254 | { |
|
| 255 | ||
| 256 | if ($result->hasError()) { |
|
| 257 | $this->console->writeln('> MxKarma save votes $f00 failure: '.$result->getError()); |
|
| 258 | ||
| 259 | return; |
|
| 260 | } |
|
| 261 | ||
| 262 | $data = $this->getObject($result->getResponse()); |
|
| 263 | ||
| 264 | if ($data === null) { |
|
| 265 | return; |
|
| 266 | } |
|
| 267 | $this->console->writeln('> MxKarma save votes $0f0success!'); |
|
| 268 | $this->dispatcher->dispatch(self::EVENT_VOTESAVE, ["updated" => $data->updated]); |
|
| 269 | } |
|
| 270 | ||
| 271 | /** |
|