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