PrizeMoney::asMoney()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
namespace GolfLeague;
3
4
class PrizeMoney {
5
6
    protected $lowScore = 7;
7
    protected $skins;
8
    protected $ctp = 5;
9
    protected $purse;
10
	protected $skinsPot;
11
12
    public function setPurse($purse)
13
    {
14
        $this->purse = $this->asMoney($purse - ($this->ctp  * 2));
15
    }
16
17
    public function getlowScore()
18
    {
19
		return $this->asMoney($this->lowScore);
20
    }
21
22
    public function getSkins()
23
    {
24
        $this->skins = .32 * $this->purse;
25
        return $this->asMoney($this->skins);
26
    }
27
28
	public function getSkinsPot($purse)
29
	{
30
		$this->skinsPot = $purse - (2*($this->ctp) + 2*($this->lowScore));
31
		return $this->asMoney($this->skinsPot);
32
	}
33
34
	public function skinsGroupPot($purse, $totalPlayers, $groupPlayers)
35
	{
36
		$this->skinsPot = $this->getSkinsPot($purse);
37
		$groupPercentage = ($groupPlayers / $totalPlayers);
38
		return ($groupPercentage * $this->skinsPot);
39
	}
40
    public function getCtp()
41
    {
42
        return $this->asMoney($this->ctp);
43
    }
44
45
	function asMoney($value) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
46
	  return number_format($value, 2);
47
	}
48
}
49