Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/Models/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ class Server
*/
protected $maxPlayers;

/**
* The map ID given to the server used by ETS2Map.
*
* @var int
*/
protected $mapId;

/**
* Determines the order in which servers are displayed.
*
Expand Down Expand Up @@ -170,6 +177,7 @@ public function __construct(array $server)
$this->players = intval($server['players']);
$this->queue = intval($server['queue']);
$this->maxPlayers = intval($server['maxplayers']);
$this->mapId = intval($server['mapid']);
$this->displayOrder = intval($server['displayorder']);
$this->speedLimiter = boolval($server['speedlimiter']);
$this->collisions = boolval($server['collisions']);
Expand Down Expand Up @@ -292,6 +300,16 @@ public function getMaxPlayers(): int
return $this->maxPlayers;
}

/**
* Get the map ID given to the server used by ETS2Map.
*
* @return int
*/
public function getMapId(): int
{
return $this->mapId;
}

/**
* Get the order ID of the server. This determines which order to display the servers in.
* The lowest number will show first.
Expand Down
8 changes: 8 additions & 0 deletions tests/Unit/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ public function it_has_max_players()
$this->assertIsInt($server->getMaxPlayers());
}

/** @test */
public function it_has_a_map_id()
{
$server = $this->servers()[0];

$this->assertIsInt($server->getMapId());
}

/** @test */
public function it_has_a_display_order()
{
Expand Down