Completed
Push — master ( 56ab9a...ae2e93 )
by Michael
02:55
created
app/library/Classes/Statistics/CourseStatistics.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@
 block discarded – undo
3 3
 
4 4
 interface CourseStatistics {
5 5
 
6
-    public function averageScore($courseId);
7
-    public function averageScoreByPlayer($courseId, $playerId);
8
-    public function averageScoreByYear($courseId, $year);
9
-    public function averageScoreByPlayerAndYear($courseId, $playerId, $year);
6
+	public function averageScore($courseId);
7
+	public function averageScoreByPlayer($courseId, $playerId);
8
+	public function averageScoreByYear($courseId, $year);
9
+	public function averageScoreByPlayerAndYear($courseId, $playerId, $year);
10 10
 
11 11
 }
12 12
\ No newline at end of file
Please login to merge, or discard this patch.
app/library/Classes/Statistics/CourseStatisticsEloquent.php 3 patches
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -4,71 +4,71 @@
 block discarded – undo
4 4
 
5 5
 class CourseStatisticsEloquent implements CourseStatistics
6 6
 {
7
-    private $date1 = '-01-01';
8
-    private $date2 = '-12-31';
7
+	private $date1 = '-01-01';
8
+	private $date2 = '-12-31';
9 9
 
10
-    public function averageScore($courseId)
11
-    {
12
-        $rounds = Round::where('course_id', '=', $courseId)->get();
13
-        $scores = $rounds->map(function($round)
14
-        {
15
-            return $round->score;
16
-        });
17
-        if($rounds->count() > 0) {
18
-            return round(array_sum($scores->toArray())/($rounds->count()), 2);
19
-        } else {
20
-            return $rounds;
21
-        }
22
-    }
23
-    public function averageScoreByPlayer($courseId, $playerId)
24
-    {
25
-        $rounds = Round::where('course_id', '=', $courseId)
26
-            ->where('player_id', '=', $playerId)
27
-            ->get();
28
-        $scores = $rounds->map(function($round)
29
-        {
30
-            return $round->score;
31
-        });
32
-        if($rounds->count() > 0) {
33
-            return round(array_sum($scores->toArray())/($rounds->count()), 2);
34
-        } else {
35
-            return $rounds;
36
-        }
37
-    }
38
-    public function averageScoreByYear($courseId, $year)
39
-    {
40
-        $rounds = Round::where('course_id', '=', $courseId)
41
-            ->where('date', '>=', $year . $this->date1)
42
-            ->where('date', '<=', $year . $this->date2)
43
-            ->get();
44
-        $scores = $rounds->map(function($round)
45
-        {
46
-            return $round->score;
47
-        });
10
+	public function averageScore($courseId)
11
+	{
12
+		$rounds = Round::where('course_id', '=', $courseId)->get();
13
+		$scores = $rounds->map(function($round)
14
+		{
15
+			return $round->score;
16
+		});
17
+		if($rounds->count() > 0) {
18
+			return round(array_sum($scores->toArray())/($rounds->count()), 2);
19
+		} else {
20
+			return $rounds;
21
+		}
22
+	}
23
+	public function averageScoreByPlayer($courseId, $playerId)
24
+	{
25
+		$rounds = Round::where('course_id', '=', $courseId)
26
+			->where('player_id', '=', $playerId)
27
+			->get();
28
+		$scores = $rounds->map(function($round)
29
+		{
30
+			return $round->score;
31
+		});
32
+		if($rounds->count() > 0) {
33
+			return round(array_sum($scores->toArray())/($rounds->count()), 2);
34
+		} else {
35
+			return $rounds;
36
+		}
37
+	}
38
+	public function averageScoreByYear($courseId, $year)
39
+	{
40
+		$rounds = Round::where('course_id', '=', $courseId)
41
+			->where('date', '>=', $year . $this->date1)
42
+			->where('date', '<=', $year . $this->date2)
43
+			->get();
44
+		$scores = $rounds->map(function($round)
45
+		{
46
+			return $round->score;
47
+		});
48 48
 
49
-        if($rounds->count() > 0) {
50
-            return round(array_sum($scores->toArray())/($rounds->count()), 2);
51
-        } else {
52
-            return $rounds;
53
-        }
54
-    }
55
-    public function averageScoreByPlayerAndYear($courseId, $playerId, $year)
56
-    {
57
-        $rounds = Round::where('course_id', '=', $courseId)
58
-            ->where('player_id', '=', $playerId)
59
-            ->where('date', '>=', $year . $this->date1)
60
-            ->where('date', '<=', $year . $this->date2)
61
-            ->get();
62
-        $scores = $rounds->map(function($round)
63
-        {
64
-            return $round->score;
65
-        });
49
+		if($rounds->count() > 0) {
50
+			return round(array_sum($scores->toArray())/($rounds->count()), 2);
51
+		} else {
52
+			return $rounds;
53
+		}
54
+	}
55
+	public function averageScoreByPlayerAndYear($courseId, $playerId, $year)
56
+	{
57
+		$rounds = Round::where('course_id', '=', $courseId)
58
+			->where('player_id', '=', $playerId)
59
+			->where('date', '>=', $year . $this->date1)
60
+			->where('date', '<=', $year . $this->date2)
61
+			->get();
62
+		$scores = $rounds->map(function($round)
63
+		{
64
+			return $round->score;
65
+		});
66 66
 
67
-        if($rounds->count() > 0) {
68
-            return round(array_sum($scores->toArray())/($rounds->count()), 2);
69
-        } else {
70
-            return $rounds;
71
-        }
72
-    }
67
+		if($rounds->count() > 0) {
68
+			return round(array_sum($scores->toArray())/($rounds->count()), 2);
69
+		} else {
70
+			return $rounds;
71
+		}
72
+	}
73 73
 
74 74
 }
75 75
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
         {
15 15
             return $round->score;
16 16
         });
17
-        if($rounds->count() > 0) {
18
-            return round(array_sum($scores->toArray())/($rounds->count()), 2);
17
+        if ($rounds->count() > 0) {
18
+            return round(array_sum($scores->toArray()) / ($rounds->count()), 2);
19 19
         } else {
20 20
             return $rounds;
21 21
         }
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
         {
30 30
             return $round->score;
31 31
         });
32
-        if($rounds->count() > 0) {
33
-            return round(array_sum($scores->toArray())/($rounds->count()), 2);
32
+        if ($rounds->count() > 0) {
33
+            return round(array_sum($scores->toArray()) / ($rounds->count()), 2);
34 34
         } else {
35 35
             return $rounds;
36 36
         }
@@ -38,16 +38,16 @@  discard block
 block discarded – undo
38 38
     public function averageScoreByYear($courseId, $year)
39 39
     {
40 40
         $rounds = Round::where('course_id', '=', $courseId)
41
-            ->where('date', '>=', $year . $this->date1)
42
-            ->where('date', '<=', $year . $this->date2)
41
+            ->where('date', '>=', $year.$this->date1)
42
+            ->where('date', '<=', $year.$this->date2)
43 43
             ->get();
44 44
         $scores = $rounds->map(function($round)
45 45
         {
46 46
             return $round->score;
47 47
         });
48 48
 
49
-        if($rounds->count() > 0) {
50
-            return round(array_sum($scores->toArray())/($rounds->count()), 2);
49
+        if ($rounds->count() > 0) {
50
+            return round(array_sum($scores->toArray()) / ($rounds->count()), 2);
51 51
         } else {
52 52
             return $rounds;
53 53
         }
@@ -56,16 +56,16 @@  discard block
 block discarded – undo
56 56
     {
57 57
         $rounds = Round::where('course_id', '=', $courseId)
58 58
             ->where('player_id', '=', $playerId)
59
-            ->where('date', '>=', $year . $this->date1)
60
-            ->where('date', '<=', $year . $this->date2)
59
+            ->where('date', '>=', $year.$this->date1)
60
+            ->where('date', '<=', $year.$this->date2)
61 61
             ->get();
62 62
         $scores = $rounds->map(function($round)
63 63
         {
64 64
             return $round->score;
65 65
         });
66 66
 
67
-        if($rounds->count() > 0) {
68
-            return round(array_sum($scores->toArray())/($rounds->count()), 2);
67
+        if ($rounds->count() > 0) {
68
+            return round(array_sum($scores->toArray()) / ($rounds->count()), 2);
69 69
         } else {
70 70
             return $rounds;
71 71
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,7 @@
 block discarded – undo
2 2
 
3 3
 use \Round;
4 4
 
5
-class CourseStatisticsEloquent implements CourseStatistics
6
-{
5
+class CourseStatisticsEloquent implements CourseStatistics {
7 6
     private $date1 = '-01-01';
8 7
     private $date2 = '-12-31';
9 8
 
Please login to merge, or discard this patch.
app/library/Classes/Statistics/StatisticsServiceProvider.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,19 +6,19 @@
 block discarded – undo
6 6
 class StatisticsServiceProvider extends ServiceProvider
7 7
 {
8 8
 
9
-    public function register()
10
-    {
11
-        $this->app->bind(
12
-          'GolfLeague\Statistics\League\LeagueStatistics',
13
-          'GolfLeague\Statistics\League\LeagueStatisticsEloquent'
14
-        );
9
+	public function register()
10
+	{
15 11
 		$this->app->bind(
16
-          'GolfLeague\Statistics\Player\PlayerStatistics',
17
-          'GolfLeague\Statistics\Player\PlayerStatisticsEloquent'
18
-        );
19
-        $this->app->bind(
20
-            'GolfLeague\Statistics\Course\CourseStatistics',
21
-            'GolfLeague\Statistics\Course\CourseStatisticsEloquent'
22
-        );
23
-    }
12
+		  'GolfLeague\Statistics\League\LeagueStatistics',
13
+		  'GolfLeague\Statistics\League\LeagueStatisticsEloquent'
14
+		);
15
+		$this->app->bind(
16
+		  'GolfLeague\Statistics\Player\PlayerStatistics',
17
+		  'GolfLeague\Statistics\Player\PlayerStatisticsEloquent'
18
+		);
19
+		$this->app->bind(
20
+			'GolfLeague\Statistics\Course\CourseStatistics',
21
+			'GolfLeague\Statistics\Course\CourseStatisticsEloquent'
22
+		);
23
+	}
24 24
 }
Please login to merge, or discard this patch.