-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathGameFactory.php
39 lines (34 loc) · 1.2 KB
/
GameFactory.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
namespace Packages\Factories\Game;
use Illuminate\Support\Str;
use Packages\Models\GameOrganizer\Game;
use Packages\Models\GameOrganizer\GameMode;
use Packages\Models\GameOrganizer\Participant\ParticipantInterface;
use Packages\Models\GameOrganizer\Participants;
class GameFactory
{
public static function makeVsPlayerGame(ParticipantInterface $whiteParticipant, ParticipantInterface $blackParticipant): Game
{
return Game::init(
Str::uuid(),
GameMode::vsPlayerMode(),
Participants::make($whiteParticipant, $blackParticipant)
);
}
public static function makeVsBotGame(ParticipantInterface $whiteParticipant, ParticipantInterface $blackParticipant): Game
{
return Game::init(
Str::uuid(),
GameMode::vsBotMode(),
Participants::make($whiteParticipant, $blackParticipant)
);
}
public static function makeViewingGame(ParticipantInterface $whiteParticipant, ParticipantInterface $blackParticipant): Game
{
return Game::init(
Str::uuid(),
GameMode::viewingMode(),
Participants::make($whiteParticipant, $blackParticipant)
);
}
}