Example #1
0
 /**
  * @Route("/champions/{id}/details", name="champion_details")
  * @Template()
  * @ActionCache(maxage=5184000)
  */
 public function detailsAction($id)
 {
     $repo = $this->get('lolapi.manager.champion');
     $champion = $repo->findOneById($id);
     $stats = new ChampionStats($champion, $this->get('service_container'));
     return ['items' => $stats->getMainItems(), 'champion' => $champion, 'stats' => $stats];
 }
Example #2
0
 public function updateChampions()
 {
     $container = $this->getContainer();
     $manager = $container->get('lolapi.manager.champion');
     $champions = $manager->findAll();
     foreach ($champions as $champion) {
         $stats = new ChampionStats($champion, $container);
         $stats->setRefresh(true);
         foreach (self::$versions as $version) {
             $stats->getPickRate($version);
             $stats->getBanRate($version);
             $stats->getUsage($version);
             $stats->getWinRate($version);
             $stats->getKillsAverage($version);
             $stats->getDeathsAverage($version);
             $stats->getAssistsAverage($version);
             $stats->getKda($version);
             $stats->getGold($version);
             foreach ($stats->getMainItems() as $item) {
                 $stats->getItemUsage($version, $item);
                 $stats->getItemWinrate($version, $item);
             }
         }
     }
 }
Example #3
0
 public function getMainChampions()
 {
     $champions = $this->container->get('lolapi.manager.champion')->getMainChampions($this->item, 12);
     usort($champions, function ($a, $b) {
         $as = new ChampionStats($a, $this->container);
         $bs = new ChampionStats($b, $this->container);
         return $as->getItemUsage('5.14', $this->item) < $bs->getItemUsage('5.14', $this->item);
     });
     return $champions;
 }