| | |
| | | */ |
| | | protected $teams = []; |
| | | |
| | | private $requiredRawFields = ['name', 'seed', 'status']; |
| | | |
| | | public function fromJson(string $jsonString) : int |
| | | public function fromJson(string $jsonString): int |
| | | { |
| | | $rawData = json_decode($jsonString, true); |
| | | |
| | |
| | | |
| | | foreach ($rawData as $key => $team) |
| | | { |
| | | $rawKeys = array_keys($team); |
| | | if (count(array_intersect($rawKeys, $this->requiredRawFields)) != 3) |
| | | $players = []; |
| | | if (is_array($team['players'])) |
| | | { |
| | | continue; |
| | | foreach ($team['players'] as $player) |
| | | { |
| | | if (!empty($player['inGameName'])) |
| | | { |
| | | $players[] = $player['inGameName']; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if ($team['status'] == 'checkedIn') |
| | | { |
| | | $this->teams[] = $team; |
| | | } |
| | | $this->teams[] = [ |
| | | 'name' => $team['name'], |
| | | 'players' => $players |
| | | ]; |
| | | } |
| | | |
| | | return (bool)count($this->teams); |
| | |
| | | <div class="col-md-4 mb-4"> |
| | | <label for="json">Csapatok API Input adatai:</label> |
| | | Pld: https://api.eslgaming.com/play/v1/leagues/198846/contestants válasz eredménye |
| | | https://api.battlefy.com/tournaments/5e9c747db75c02203ab68eed/teams?page=1&limit=64 |
| | | <textarea class="form-control" name="json" id="json"></textarea> |
| | | <button class="btn btn-secondary" type="submit">Csapatok frissítése</button> |
| | | </div> |
| | |
| | | {% block info_right %} |
| | | <span class="info right"> |
| | | {% if stripe.cup.number starts with '#' %} |
| | | <img class="esl-logo" src="/assets/ESL_Logo.png"/> |
| | | <img class="wargasz-logo" src="/assets/WARGASZ_color.png"/> |
| | | {% endif %} |
| | | </span> |
| | | {% endblock %} |