Completed
Push — master ( f9d170...cbeeb7 )
by Michael
08:03
created
app/library/Classes/Handicap.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@
 block discarded – undo
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
 	{
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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];
Please login to merge, or discard this patch.
Braces   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,10 +5,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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];
Please login to merge, or discard this patch.