Example #1
0
 /**
  * @param \Illuminate\Cache\Repository $cache
  * @param \App\Services\StaticDataService $staticData
  * @param \Ekko\Contract\EkkoInterface $ekko
  */
 public function __construct(Cache $cache, StaticDataService $staticData, EkkoInterface $ekko)
 {
     $this->cache = $cache;
     $this->ekko = $ekko;
     $this->ekko->setApiKey('625d373a-a598-41f8-b088-c61cfb804a37');
     $this->ekko->setRegion('EUW');
     $this->staticData = $staticData;
 }
 /**
  * @param \Ekko\Contract\EkkoInterface $ekko
  * @param \App\Services\StaticDataService $service
  * @param $summoner
  *
  * @return \Ekko\Collection\ChampionStatsCollection
  */
 public function rankedStats(EkkoInterface $ekko, StaticDataService $service, $summoner)
 {
     $ekko->setApiKey('625d373a-a598-41f8-b088-c61cfb804a37');
     $ekko->setRegion('EUW');
     $data = $ekko->stats()->getRankedStats($summoner, 'SEASON2016');
     $data->each(function (ChampionStats $championStats) use($service) {
         /**
          * @var Champion $championData
          */
         $championData = $service->getChampionData()->get($championStats->id);
         if (!is_null($championData)) {
             $championStats->championAvatar = $championData->image->full;
             $championStats->championName = $championData->name;
         }
     });
     return $data;
 }
 /**
  * @return Realm
  */
 public function getRealmData()
 {
     $that = $this;
     return $this->cache->get('ekko:static:realm', function () use($that) {
         $data = $this->ekko->data()->getRealm();
         $that->cache->add('ekko:static:realm', $data, 60 * 24 * 7);
         return $data;
     });
 }