Skip to content

Commit

Permalink
Remove any dangling references to models in their old top-level names…
Browse files Browse the repository at this point in the history
…pace

The usage in a string in the call to sort was actually breaking seriesreport.php
  • Loading branch information
bakert committed Sep 4, 2024
1 parent 3daf75d commit 6dc824e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 56 deletions.
2 changes: 1 addition & 1 deletion gatherling/Models/Series.php
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ public static function seasonStandings($series, $season)
$seasonevents = $series->getSeasonEventNames($season);
$points = $series->seasonPointsTable($season);
$cutoff = $series->getSeasonCutoff($season);
uasort($points, 'Gatherling\Series::reverse_total_sort');
uasort($points, 'Gatherling\Models\Series::reverse_total_sort');

echo "<h3><center>Scoreboard for {$series->name} season {$season}</center></h3>";
echo '<table class="scoreboard">';
Expand Down
63 changes: 8 additions & 55 deletions gatherling/api_lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,7 @@ function arg($key, $default = null)
return $_REQUEST[$key];
}

//## Models
/**
* @param Gatherling\Event $event
*
* @return mixed
*/
function repr_json_event($event)
function repr_json_event(Event $event)
{
$series = new Series($event->series);
$json = [];
Expand Down Expand Up @@ -193,12 +187,7 @@ function repr_json_event($event)
return $json;
}

/**
* @param Gatherling\Deck $deck
*
* @return mixed
*/
function repr_json_deck($deck)
function repr_json_deck(Deck $deck)
{
$json = [];
$json['id'] = $deck->id;
Expand All @@ -214,12 +203,7 @@ function repr_json_deck($deck)
return $json;
}

/**
* @param Gatherling\Series $series
*
* @return mixed
*/
function repr_json_series($series)
function repr_json_series(Series $series)
{
$json = populate([], $series, ['name', 'active', 'start_day', 'start_time', 'organizers', 'mtgo_room', 'this_season_format', 'this_season_master_link', 'this_season_season', 'discord_guild_id', 'discord_channel_id', 'discord_channel_name', 'discord_guild_name']);
$mostRecent = $series->mostRecentEvent();
Expand All @@ -230,13 +214,7 @@ function repr_json_series($series)
return $json;
}

/**
* @param Gatherling\Player $player
* @param int $client
*
* @return mixed
*/
function repr_json_player($player, $client = null)
function repr_json_player(Player $player, ?int $client = null): mixed
{
$json = populate([], $player, ['name', 'verified', 'discord_id', 'discord_handle', 'mtga_username', 'mtgo_username']);
$json['display_name'] = $player->gameName($client);
Expand All @@ -247,13 +225,9 @@ function repr_json_player($player, $client = null)
//## Actions

/**
* @param Gatherling\Event $event
* @param string $name
* @param string $decklist
*
* @return (bool|string|int)[]|false[]|(string|false)[]
*/
function add_player_to_event($event, $name, $decklist)
function add_player_to_event(Event $event, ?string $name, ?string $decklist)
{
$result = [];
if ($event->authCheck($_SESSION['username'])) {
Expand Down Expand Up @@ -287,13 +261,7 @@ function add_player_to_event($event, $name, $decklist)
return $result;
}

/**
* @param Gatherling\Event $event
* @param string $name
*
* @return array
*/
function delete_player_from_event($event, $name)
function delete_player_from_event(Event $event, ?string $name): array
{
if ($event->authCheck($_SESSION['username'])) {
$result = [];
Expand All @@ -307,13 +275,7 @@ function delete_player_from_event($event, $name)
return $result;
}

/**
* @param Gatherling\Event $event
* @param string $name
*
* @return array
*/
function drop_player_from_event($event, $name)
function drop_player_from_event(Event $event, ?string $name): array
{
if ($event->authCheck($_SESSION['username'])) {
$event->dropPlayer($name);
Expand Down Expand Up @@ -401,16 +363,7 @@ function create_event()
return $result;
}

/**
* @param Gatherling\Event $event
* @param mixed $round
* @param string $a
* @param string $b
* @param string $res
*
* @return void
*/
function create_pairing($event, $round, $a, $b, $res)
function create_pairing(Event $event, mixed $round, ?string $a, ?string $b, ?string $res): void
{
if (!is_admin() && !$event->authCheck(Player::loginName())) {
error('Unauthorized');
Expand Down

0 comments on commit 6dc824e

Please sign in to comment.