CashGameParameters::maximumBuyIn()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Cysha\Casino\Holdem\Game\Parameters;
4
5
use Cysha\Casino\Game\Chips;
6
use Cysha\Casino\Game\Contracts\GameParameters;
7
use Ramsey\Uuid\Uuid;
8
9
class CashGameParameters extends DefaultParameters implements GameParameters
10
{
11
    /**
12
     * @var Chips
13
     */
14
    private $smallBlind;
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
15
16
    /**
17
     * @var Chips
18
     */
19
    private $bigBlind;
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
20
21
    /**
22
     * @var int
23
     */
24
    private $tableSize = 9;
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
25
26
    /**
27
     * @var Chips
28
     */
29
    private $minimumBuyIn;
30
31
    /**
32
     * @var Chips
33
     */
34
    private $maximumBuyIn;
35
36
    public function __construct(Uuid $gameId, Chips $bigBlind, Chips $smallBlind = null, int $tableSize = 9, Chips $minimumBuyIn, Chips $maximumBuyIn = null)
0 ignored issues
show
Coding Style introduced by
Parameters which have default values should be placed at the end.

If you place a parameter with a default value before a parameter with a default value, the default value of the first parameter will never be used as it will always need to be passed anyway:

// $a must always be passed; it's default value is never used.
function someFunction($a = 5, $b) { }
Loading history...
37
    {
38
        parent::__construct($gameId, $bigBlind, $smallBlind, $tableSize);
39
40
        $this->minimumBuyIn = $minimumBuyIn;
41
        $this->maximumBuyIn = $maximumBuyIn;
42
    }
43
44
    /**
45
     * @return Chips
46
     */
47
    public function minimumBuyIn(): Chips
48
    {
49
        return $this->minimumBuyIn;
50
    }
51
52
    /**
53
     * @return Chips
54
     */
55
    public function maximumBuyIn(): Chips
56
    {
57
        return $this->maximumBuyIn ?? Chips::zero();
58
    }
59
}
60