@@ -7,16 +7,16 @@ |
||
7 | 7 | |
8 | 8 | class Handicap |
9 | 9 | { |
10 | - private $differentialArray; |
|
11 | - private $player; |
|
12 | - private $roundsUsed; |
|
10 | + private $differentialArray; |
|
11 | + private $player; |
|
12 | + private $roundsUsed; |
|
13 | 13 | |
14 | 14 | public function __construct(Player $player, $roundsUsed = 20) |
15 | - { |
|
16 | - $this->differentialArray = array(0,1,1,1,1,1,1,2,2,3,3,4,4,5,5,6,6,7,8,9,10); |
|
15 | + { |
|
16 | + $this->differentialArray = array(0,1,1,1,1,1,1,2,2,3,3,4,4,5,5,6,6,7,8,9,10); |
|
17 | 17 | $this->player = $player; |
18 | - $this->roundsUsed = $roundsUsed; //20 is USGA standard; Some leagues may want to adjust. |
|
19 | - } |
|
18 | + $this->roundsUsed = $roundsUsed; //20 is USGA standard; Some leagues may want to adjust. |
|
19 | + } |
|
20 | 20 | |
21 | 21 | public function calculate() |
22 | 22 | { |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | public function __construct(Player $player, $roundsUsed = 20) |
15 | 15 | { |
16 | - $this->differentialArray = array(0,1,1,1,1,1,1,2,2,3,3,4,4,5,5,6,6,7,8,9,10); |
|
16 | + $this->differentialArray = array(0, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 8, 9, 10); |
|
17 | 17 | $this->player = $player; |
18 | 18 | $this->roundsUsed = $roundsUsed; //20 is USGA standard; Some leagues may want to adjust. |
19 | 19 | } |
@@ -25,16 +25,16 @@ discard block |
||
25 | 25 | |
26 | 26 | $i = 1; |
27 | 27 | foreach ($rounds as $round) { |
28 | - $differentials[$i] = $round->esc; |
|
28 | + $differentials[$i] = $round->esc; |
|
29 | 29 | $i++; |
30 | 30 | } |
31 | 31 | sort($differentials); |
32 | - $chunkedRounds = array_chunk($differentials,$differential,true); |
|
32 | + $chunkedRounds = array_chunk($differentials, $differential, true); |
|
33 | 33 | $roundsUsed = $chunkedRounds[0]; |
34 | 34 | |
35 | 35 | $sumofDifferentials = array_sum($roundsUsed); |
36 | 36 | $handicap = (($sumofDifferentials / $differential) * .96) - 36; |
37 | - $handicap = round($handicap ,2); |
|
37 | + $handicap = round($handicap, 2); |
|
38 | 38 | |
39 | 39 | return $handicap; |
40 | 40 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | // |
43 | 43 | public function differential($numberOfScores) |
44 | 44 | { |
45 | - if($numberOfScores <= 20){ |
|
45 | + if ($numberOfScores <= 20) { |
|
46 | 46 | return $this->differentialArray[$numberOfScores]; |
47 | 47 | } else { |
48 | 48 | return $this->differentialArray[20]; |
@@ -5,14 +5,13 @@ discard block |
||
5 | 5 | use \Player as Player; |
6 | 6 | use \Round as Round; |
7 | 7 | |
8 | -class Handicap |
|
9 | -{ |
|
8 | +class Handicap { |
|
10 | 9 | private $differentialArray; |
11 | 10 | private $player; |
12 | 11 | private $roundsUsed; |
13 | 12 | |
14 | 13 | public function __construct(Player $player, $roundsUsed = 20) |
15 | - { |
|
14 | + { |
|
16 | 15 | $this->differentialArray = array(0,1,1,1,1,1,1,2,2,3,3,4,4,5,5,6,6,7,8,9,10); |
17 | 16 | $this->player = $player; |
18 | 17 | $this->roundsUsed = $roundsUsed; //20 is USGA standard; Some leagues may want to adjust. |
@@ -24,7 +23,7 @@ discard block |
||
24 | 23 | $differential = $this->differential($rounds->count()); |
25 | 24 | |
26 | 25 | $i = 1; |
27 | - foreach ($rounds as $round) { |
|
26 | + foreach ($rounds as $round) { |
|
28 | 27 | $differentials[$i] = $round->esc; |
29 | 28 | $i++; |
30 | 29 | } |
@@ -42,7 +41,7 @@ discard block |
||
42 | 41 | // |
43 | 42 | public function differential($numberOfScores) |
44 | 43 | { |
45 | - if($numberOfScores <= 20){ |
|
44 | + if($numberOfScores <= 20) { |
|
46 | 45 | return $this->differentialArray[$numberOfScores]; |
47 | 46 | } else { |
48 | 47 | return $this->differentialArray[20]; |