-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDice.php
55 lines (47 loc) · 1.01 KB
/
Dice.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
namespace Mouson\Template;
class Dice
{
/**
* @var string
*/
private $category;
private $winnerPoint;
/**
* @return string
*/
public function getCategory(): string
{
return $this->category;
}
/**
* @return int
*/
public function getWinnerPoint(): int
{
return $this->winnerPoint;
}
/**
* Dice constructor.
*
* @param false|string[] $diceSet
*/
public function __construct($diceSet)
{
$diceTimes = array_unique($diceSet);
$diceCount = count($diceTimes);
$this->category = 'no points';
$this->winnerPoint = 0;
if ($diceCount == 1) {
$this->category = 'all the same kind';
$this->winnerPoint = $diceSet[0];
}
if ($diceCount == 3) {
$this->category = 'normal point';
}
}
public function isCategoryNoPoint()
{
return $this->category == "no point";
}
}