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