/**
  * @param \Illuminate\Http\Request $request
  * @param \App\Services\MatchService $service
  * @param $summoner
  * @param $champion
  *
  * @return array|\Ekko\Collection\MatchCollection
  */
 public function championStatus(Request $request, MatchService $service, $summoner, $champion)
 {
     $matchHistory = $service->getMatchesForChampion($summoner, $champion);
     $matches = new MatchCollection();
     $matchHistory->each(function (MatchReference $matchReference) use($service, $matches, $matchHistory) {
         $match = $service->getMatch($matchReference->matchId);
         $match->timeline = null;
         $matches->push($match);
     });
     if ($matches->count() <= 5) {
         return ['status' => 'new', 'data' => $matches->count()];
     }
     $streak = $matches->getStreak($summoner);
     if ($streak['count'] >= 5) {
         return ['status' => 'streak', 'data' => $streak];
     }
     return ['status' => null, 'data' => null];
 }
Example #2
0
 /**
  * @param \App\Services\MatchService $service
  * @param int $match
  *
  * @return \Ekko\Model\Match
  */
 public function match(MatchService $service, $match)
 {
     return $service->getMatch($match);
 }