| Conditions | 6 |
| Paths | 14 |
| Total Lines | 30 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 33 | public function handle(Message $message) |
||
| 34 | { |
||
| 35 | $collection = $this->validator->validate($message); |
||
| 36 | $hasAnswers = false; |
||
| 37 | |||
| 38 | foreach ($collection as $state) { |
||
| 39 | $user = $state->getUser(); |
||
| 40 | |||
| 41 | if ($state->isIncrement()) { |
||
| 42 | $message->user->addKarmaTo($user, $message); |
||
| 43 | |||
| 44 | if ($user->id === \Auth::user()->id) { |
||
| 45 | $message->answer(\Lang::get('karma.bot', [ |
||
| 46 | 'user' => $message->user->login |
||
| 47 | ])); |
||
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | if (!$state->isNothing()) { |
||
| 52 | $hasAnswers = true; |
||
| 53 | $message->italic($state->getTranslation($user->karma_text)); |
||
| 54 | } |
||
| 55 | } |
||
| 56 | |||
| 57 | if (!$hasAnswers) { |
||
| 58 | return $message; |
||
| 59 | } |
||
| 60 | |||
| 61 | return Storage::SIGNAL_STOP; |
||
| 62 | } |
||
| 63 | } |
||
| 64 |