/** * Events constructor. * @param $arme_id * @param $sexe * @param $event_category_id * @param Settings $settings * @internal param $competition_id */ public function __construct($id, $arme_id, $sexe, $event_category_id, $endRegistration, Settings $settings) { $this->id = $id; $this->arme = Weapon::getArme($arme_id, $settings->lang); $this->sexe = $sexe; $this->event_category = $this->getEventCategory($settings->getCategoryEvent(), $event_category_id); $this->competition_id = $settings->getTournamentId(); $this->endRegistration = $endRegistration; $this->setEventName($settings); }
/** * @param Settings $settings * @return array */ public static function getEpreuveForTournament(Settings $settings) { $listEvents = json_decode(file_get_contents($settings->apiRoute . "epreuves/for-competition/" . $settings->getTournamentId())); $listEpreuve = array(); foreach ($listEvents->data as $epreuve) { $listEpreuve[] = new Events($epreuve->id, $epreuve->arme_id, $epreuve->sexe, $epreuve->categorie_epreuve_id, $epreuve->dateHeureDebut, $settings); } usort($listEpreuve, function ($a, $b) { return strcmp($a->getEventName(), $b->getEventName()); }); return $listEpreuve; }