-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCompare.php
29 lines (25 loc) · 863 Bytes
/
Compare.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
<?php
namespace Mouson\Template;
class Compare
{
/**
* Compare constructor.
*
* @param Dice $getDice
* @param Dice $getDice1
*/
public function __construct(\Mouson\Template\Dice $firstDice, \Mouson\Template\Dice $secondDice)
{
if ($firstDice->isCategoryNoPoint() &&
$firstDice->getCategory() == $secondDice->getCategory()) {
return 'Tie.';
}
if ($firstDice->getCategory() == $secondDice->getCategory()) {
if (($firstDice->getWinnerPoint() == $secondDice->getWinnerPoint())){
return'Tie.';
}
$winner = ($firstDice->getWinnerPoint() > $secondDice->getWinnerPoint()) ? $firstPlayer : $secondPlayer;
return $winner->getName() . " wins, all the same kind:" . $winner->getDice()->getWinnerPoint();
}
}
}