Completed
Push — master ( d565f6...12549b )
by Michael
02:45
created
app/library/Services/CarryOver.php 3 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -7,29 +7,29 @@
 block discarded – undo
7 7
 class CarryOver
8 8
 {
9 9
 
10
-    public function calculate()
11
-    {
12
-        $levels = Level::all();
13
-        $matches = Match::all();
14
-        $carryOverMoney = array();
15
-        foreach ($levels as $key => $level){
16
-            $carryOverMoney[$level->id] = 0;
17
-            foreach($matches as $matchesKey => $match) {
18
-                //check skins table for level and match
19
-                $skins = Skin::where('match_id', '=', $match->id)->where('level_id', '=', $level->id)->get();
20
-                if($skins->count() === 0 ) {
21
-                    if ($level->id === 1){
22
-                        $carryOverMoney[$level->id] += $match->skinsamoney;
23
-                    }
24
-                    else {
25
-                        $carryOverMoney[$level->id] += $match->skinsbmoney;
26
-                    }
27
-                }
28
-                else {
29
-                    $carryOverMoney[$level->id] = 0; //reset carryover money
30
-                }
31
-            }
32
-        }// End foreach
33
-        return $carryOverMoney;
34
-    }
10
+	public function calculate()
11
+	{
12
+		$levels = Level::all();
13
+		$matches = Match::all();
14
+		$carryOverMoney = array();
15
+		foreach ($levels as $key => $level){
16
+			$carryOverMoney[$level->id] = 0;
17
+			foreach($matches as $matchesKey => $match) {
18
+				//check skins table for level and match
19
+				$skins = Skin::where('match_id', '=', $match->id)->where('level_id', '=', $level->id)->get();
20
+				if($skins->count() === 0 ) {
21
+					if ($level->id === 1){
22
+						$carryOverMoney[$level->id] += $match->skinsamoney;
23
+					}
24
+					else {
25
+						$carryOverMoney[$level->id] += $match->skinsbmoney;
26
+					}
27
+				}
28
+				else {
29
+					$carryOverMoney[$level->id] = 0; //reset carryover money
30
+				}
31
+			}
32
+		}// End foreach
33
+		return $carryOverMoney;
34
+	}
35 35
 }
36 36
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@
 block discarded – undo
12 12
         $levels = Level::all();
13 13
         $matches = Match::all();
14 14
         $carryOverMoney = array();
15
-        foreach ($levels as $key => $level){
15
+        foreach ($levels as $key => $level) {
16 16
             $carryOverMoney[$level->id] = 0;
17
-            foreach($matches as $matchesKey => $match) {
17
+            foreach ($matches as $matchesKey => $match) {
18 18
                 //check skins table for level and match
19 19
                 $skins = Skin::where('match_id', '=', $match->id)->where('level_id', '=', $level->id)->get();
20
-                if($skins->count() === 0 ) {
21
-                    if ($level->id === 1){
20
+                if ($skins->count() === 0) {
21
+                    if ($level->id === 1) {
22 22
                         $carryOverMoney[$level->id] += $match->skinsamoney;
23 23
                     }
24 24
                     else {
Please login to merge, or discard this patch.
Braces   +5 added lines, -8 removed lines patch added patch discarded remove patch
@@ -4,28 +4,25 @@
 block discarded – undo
4 4
 use \Skin;
5 5
 use \Level;
6 6
 
7
-class CarryOver
8
-{
7
+class CarryOver {
9 8
 
10 9
     public function calculate()
11 10
     {
12 11
         $levels = Level::all();
13 12
         $matches = Match::all();
14 13
         $carryOverMoney = array();
15
-        foreach ($levels as $key => $level){
14
+        foreach ($levels as $key => $level) {
16 15
             $carryOverMoney[$level->id] = 0;
17 16
             foreach($matches as $matchesKey => $match) {
18 17
                 //check skins table for level and match
19 18
                 $skins = Skin::where('match_id', '=', $match->id)->where('level_id', '=', $level->id)->get();
20 19
                 if($skins->count() === 0 ) {
21
-                    if ($level->id === 1){
20
+                    if ($level->id === 1) {
22 21
                         $carryOverMoney[$level->id] += $match->skinsamoney;
23
-                    }
24
-                    else {
22
+                    } else {
25 23
                         $carryOverMoney[$level->id] += $match->skinsbmoney;
26 24
                     }
27
-                }
28
-                else {
25
+                } else {
29 26
                     $carryOverMoney[$level->id] = 0; //reset carryover money
30 27
                 }
31 28
             }
Please login to merge, or discard this patch.
app/library/Services/CalendarService.php 3 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -6,35 +6,35 @@
 block discarded – undo
6 6
 
7 7
 class CalendarService
8 8
 {
9
-    // Containing our matchRepository to make all our database calls to
10
-    protected $matchRepo;
9
+	// Containing our matchRepository to make all our database calls to
10
+	protected $matchRepo;
11 11
 
12
-    /**
13
-     * Loads our $matchRepo
14
-     *
15
-     * @param MatchRepository $matchRepo
16
-     * @return CalendarService
17
-     */
18
-    public function __construct(MatchRepository $matchRepo)
19
-    {
20
-        $this->matchRepo = $matchRepo;
21
-    }
12
+	/**
13
+	 * Loads our $matchRepo
14
+	 *
15
+	 * @param MatchRepository $matchRepo
16
+	 * @return CalendarService
17
+	 */
18
+	public function __construct(MatchRepository $matchRepo)
19
+	{
20
+		$this->matchRepo = $matchRepo;
21
+	}
22 22
 
23
-    public function getByDate($startDate, $endDate)
24
-    {
25
-        $events = $this->matchRepo->getByDate($startDate, $endDate);
26
-        //Decorate for javascript Calendar
27
-        return $this->formatEvents($events);
28
-    }
23
+	public function getByDate($startDate, $endDate)
24
+	{
25
+		$events = $this->matchRepo->getByDate($startDate, $endDate);
26
+		//Decorate for javascript Calendar
27
+		return $this->formatEvents($events);
28
+	}
29 29
 
30
-    public function formatEvents($events)
31
-    {
32
-        $events->toArray();
33
-        foreach($events as $event){
34
-            $event['title'] = 'Match ' . $event->course->name;
35
-            $event['url'] = 'matches/' . $event->id . '/edit?group=1';
36
-        }
37
-        return $events;
38
-    }
30
+	public function formatEvents($events)
31
+	{
32
+		$events->toArray();
33
+		foreach($events as $event){
34
+			$event['title'] = 'Match ' . $event->course->name;
35
+			$event['url'] = 'matches/' . $event->id . '/edit?group=1';
36
+		}
37
+		return $events;
38
+	}
39 39
 
40 40
 }
41 41
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@
 block discarded – undo
30 30
     public function formatEvents($events)
31 31
     {
32 32
         $events->toArray();
33
-        foreach($events as $event){
34
-            $event['title'] = 'Match ' . $event->course->name;
35
-            $event['url'] = 'matches/' . $event->id . '/edit?group=1';
33
+        foreach ($events as $event) {
34
+            $event['title'] = 'Match '.$event->course->name;
35
+            $event['url'] = 'matches/'.$event->id.'/edit?group=1';
36 36
         }
37 37
         return $events;
38 38
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,8 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
 use GolfLeague\Storage\Match\MatchRepository;
6 6
 
7
-class CalendarService
8
-{
7
+class CalendarService {
9 8
     // Containing our matchRepository to make all our database calls to
10 9
     protected $matchRepo;
11 10
 
@@ -30,7 +29,7 @@  discard block
 block discarded – undo
30 29
     public function formatEvents($events)
31 30
     {
32 31
         $events->toArray();
33
-        foreach($events as $event){
32
+        foreach($events as $event) {
34 33
             $event['title'] = 'Match ' . $event->course->name;
35 34
             $event['url'] = 'matches/' . $event->id . '/edit?group=1';
36 35
         }
Please login to merge, or discard this patch.
app/library/Services/ScoreService.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -12,30 +12,30 @@
 block discarded – undo
12 12
 class ScoreService
13 13
 {
14 14
 
15
-    // Containing our matchRepository to make all our database calls
16
-    protected $matchRepo;
15
+	// Containing our matchRepository to make all our database calls
16
+	protected $matchRepo;
17 17
 
18
-    /**
19
-    * Loads our $matchRepo
20
-    *
21
-    * @param MatchRepository $matchRepo
22
-    * @return MatchService
23
-    */
24
-    public function __construct(MatchRepository $matchRepo,
25
-                                HoleScoreRepo $holeScoreRepo,
26
-                                Player $player,
27
-                                Match $match,
28
-                                Dispatcher $events)
29
-    {
30
-        $this->matchRepo = $matchRepo;
31
-        $this->holeScoreRepo = $holeScoreRepo;
32
-        $this->player = $player;
33
-        $this->match = $match;
34
-        $this->events = $events;
35
-    }
18
+	/**
19
+	 * Loads our $matchRepo
20
+	 *
21
+	 * @param MatchRepository $matchRepo
22
+	 * @return MatchService
23
+	 */
24
+	public function __construct(MatchRepository $matchRepo,
25
+								HoleScoreRepo $holeScoreRepo,
26
+								Player $player,
27
+								Match $match,
28
+								Dispatcher $events)
29
+	{
30
+		$this->matchRepo = $matchRepo;
31
+		$this->holeScoreRepo = $holeScoreRepo;
32
+		$this->player = $player;
33
+		$this->match = $match;
34
+		$this->events = $events;
35
+	}
36 36
 
37
-    public function update($id, $score)
38
-    {
39
-        $this->holeScoreRepo->update($id, $score);
40
-    }
37
+	public function update($id, $score)
38
+	{
39
+		$this->holeScoreRepo->update($id, $score);
40
+	}
41 41
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,7 @@
 block discarded – undo
9 9
 /**
10 10
 * ScoreService, containing all useful methods for business logic for scoring a round
11 11
 */
12
-class ScoreService
13
-{
12
+class ScoreService {
14 13
 
15 14
     // Containing our matchRepository to make all our database calls
16 15
     protected $matchRepo;
Please login to merge, or discard this patch.
app/library/Classes/Statistics/StatisticsServiceProvider.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,7 @@
 block discarded – undo
3 3
 use Illuminate\Support\ServiceProvider;
4 4
 
5 5
 
6
-class StatisticsServiceProvider extends ServiceProvider
7
-{
6
+class StatisticsServiceProvider extends ServiceProvider {
8 7
 
9 8
     public function register()
10 9
     {
Please login to merge, or discard this 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.
app/library/Classes/Statistics/ScoreType.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,9 +5,9 @@
 block discarded – undo
5 5
 class ScoreType
6 6
 {
7 7
 	public function __construct()
8
-    {
8
+	{
9 9
 
10
-    }
10
+	}
11 11
 
12 12
 	public function calculate()
13 13
 	{
Please login to merge, or discard this patch.
Braces   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,10 +2,9 @@
 block discarded – undo
2 2
 
3 3
 namespace GolfLeague;
4 4
 
5
-class ScoreType
6
-{
5
+class ScoreType {
7 6
 	public function __construct()
8
-    {
7
+	{
9 8
 
10 9
     }
11 10
 
Please login to merge, or discard this patch.
app/library/Classes/EquitableStrokeControl.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
 	public function __construct(Holescore $holescore)
22 22
 	{
23
-		$this->holescore= $holescore;
23
+		$this->holescore = $holescore;
24 24
 	}
25 25
 
26 26
 	public function calculate()
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		//Use par and handicap to determine max score for a hole
41 41
 		$maxScore = $this->maxAllowableScore($holePar, $handicap);
42 42
 
43
-		if($holescore > $maxScore) {
43
+		if ($holescore > $maxScore) {
44 44
 			return $maxScore;
45 45
 		}
46 46
 		return $holescore;
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 	private function maxAllowableScore($par, $handicap)
51 51
 	{
52
-		switch($handicap) {
52
+		switch ($handicap) {
53 53
 			case ($handicap < 4.6):
54 54
 				$maxScore = $par + 2;
55 55
 				break;
Please login to merge, or discard this patch.
app/library/Classes/PrizeMoney.php 3 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -3,27 +3,27 @@  discard block
 block discarded – undo
3 3
 
4 4
 class PrizeMoney {
5 5
 
6
-    protected $lowScore = 7;
7
-    protected $skins;
8
-    protected $ctp = 5;
9
-    protected $purse;
6
+	protected $lowScore = 7;
7
+	protected $skins;
8
+	protected $ctp = 5;
9
+	protected $purse;
10 10
 	protected $skinsPot;
11 11
 
12
-    public function setPurse($purse)
13
-    {
14
-        $this->purse = $this->asMoney($purse - ($this->ctp  * 2));
15
-    }
12
+	public function setPurse($purse)
13
+	{
14
+		$this->purse = $this->asMoney($purse - ($this->ctp  * 2));
15
+	}
16 16
 
17
-    public function getlowScore()
18
-    {
17
+	public function getlowScore()
18
+	{
19 19
 		return $this->asMoney($this->lowScore);
20
-    }
20
+	}
21 21
 
22
-    public function getSkins()
23
-    {
24
-        $this->skins = .32 * $this->purse;
25
-        return $this->asMoney($this->skins);
26
-    }
22
+	public function getSkins()
23
+	{
24
+		$this->skins = .32 * $this->purse;
25
+		return $this->asMoney($this->skins);
26
+	}
27 27
 
28 28
 	public function getSkinsPot($purse)
29 29
 	{
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
 		$groupPercentage = ($groupPlayers / $totalPlayers);
38 38
 		return ($groupPercentage * $this->skinsPot);
39 39
 	}
40
-    public function getCtp()
41
-    {
42
-        return $this->asMoney($this->ctp);
43
-    }
40
+	public function getCtp()
41
+	{
42
+		return $this->asMoney($this->ctp);
43
+	}
44 44
 
45 45
 	function asMoney($value) {
46 46
 	  return number_format($value, 2);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
     public function setPurse($purse)
13 13
     {
14
-        $this->purse = $this->asMoney($purse - ($this->ctp  * 2));
14
+        $this->purse = $this->asMoney($purse - ($this->ctp * 2));
15 15
     }
16 16
 
17 17
     public function getlowScore()
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 	public function getSkinsPot($purse)
29 29
 	{
30
-		$this->skinsPot = $purse - (2*($this->ctp) + 2*($this->lowScore));
30
+		$this->skinsPot = $purse - (2 * ($this->ctp) + 2 * ($this->lowScore));
31 31
 		return $this->asMoney($this->skinsPot);
32 32
 	}
33 33
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,8 @@
 block discarded – undo
42 42
         return $this->asMoney($this->ctp);
43 43
     }
44 44
 
45
-	function asMoney($value) {
45
+	function asMoney($value)
46
+	{
46 47
 	  return number_format($value, 2);
47 48
 	}
48 49
 }
Please login to merge, or discard this patch.
app/library/Classes/Games.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -5,30 +5,30 @@
 block discarded – undo
5 5
 class Games
6 6
 {
7 7
 	public function __construct()
8
-    {
8
+	{
9 9
 
10
-    }
10
+	}
11 11
 
12 12
 	public function getGrossWinner()
13 13
 	{
14 14
 		return 'gross';
15 15
 		//take an array of players and gross score
16 16
 		//find lowest and return
17
-        //for each score in a given round determine +/- for each
18
-        //sort and return
17
+		//for each score in a given round determine +/- for each
18
+		//sort and return
19 19
 
20 20
 
21 21
 	}
22 22
 
23
-    public function getNetWinner()
24
-    {
25
-        //for each score in a given round determine +/- for each AFTER subtracting handicap
23
+	public function getNetWinner()
24
+	{
25
+		//for each score in a given round determine +/- for each AFTER subtracting handicap
26 26
 
27
-    }
27
+	}
28 28
 
29
-    public function currentParTotal($courseId, $holesPlayed)
30
-    {
31
-        //find par total for course given unmber of holes played
29
+	public function currentParTotal($courseId, $holesPlayed)
30
+	{
31
+		//find par total for course given unmber of holes played
32 32
 
33
-    }
33
+	}
34 34
 }
35 35
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,10 +2,9 @@
 block discarded – undo
2 2
 
3 3
 namespace GolfLeague;
4 4
 
5
-class Games
6
-{
5
+class Games {
7 6
 	public function __construct()
8
-    {
7
+	{
9 8
 
10 9
     }
11 10
 
Please login to merge, or discard this patch.
app/library/Storage/EloquentRepositories/EloquentCtpRepository.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -12,42 +12,42 @@
 block discarded – undo
12 12
    * Multideminsional Array of Hole Numbers and scores   *
13 13
    **/
14 14
 
15
-    public function all()
16
-    {
17
-        return Ctp::all();
18
-    }
19
-
20
-    public function find($id)
21
-    {
22
-        return Ctp::find($id);
23
-    }
24
-
25
-    //Find Ctps by Player Id
26
-    public function findByPlayer($playerId)
27
-    {
28
-        return Ctp::with('player', 'hole', 'match')->where('player_id', '=', $playerId)->get();
29
-    }
30
-
31
-    public function findByHole($holeId)
32
-    {
33
-        return Ctp::with('player', 'hole')->where('hole_id', '=', $holeId)->get();
34
-    }
35
-
36
-    public function findByMatch($matchId)
37
-    {
38
-        return Ctp::with('player', 'hole')->where('match_id', '=', $matchId)->get();
39
-    }
40
-
41
-    public function create($input)
42
-    {
43
-        return Ctp::create($input);
44
-    }
45
-
46
-    //pass this a Ctp Eloquent object and replace it in database
47
-    public function update($ctp)
48
-    {
49
-        $updateCtp = Ctp::find($ctp->id);
50
-        $updateCtp = $ctp;
51
-        $updateCtp->save();
52
-    }
15
+	public function all()
16
+	{
17
+		return Ctp::all();
18
+	}
19
+
20
+	public function find($id)
21
+	{
22
+		return Ctp::find($id);
23
+	}
24
+
25
+	//Find Ctps by Player Id
26
+	public function findByPlayer($playerId)
27
+	{
28
+		return Ctp::with('player', 'hole', 'match')->where('player_id', '=', $playerId)->get();
29
+	}
30
+
31
+	public function findByHole($holeId)
32
+	{
33
+		return Ctp::with('player', 'hole')->where('hole_id', '=', $holeId)->get();
34
+	}
35
+
36
+	public function findByMatch($matchId)
37
+	{
38
+		return Ctp::with('player', 'hole')->where('match_id', '=', $matchId)->get();
39
+	}
40
+
41
+	public function create($input)
42
+	{
43
+		return Ctp::create($input);
44
+	}
45
+
46
+	//pass this a Ctp Eloquent object and replace it in database
47
+	public function update($ctp)
48
+	{
49
+		$updateCtp = Ctp::find($ctp->id);
50
+		$updateCtp = $ctp;
51
+		$updateCtp->save();
52
+	}
53 53
 }
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 \Ctp as Ctp;
4 4
 
5
-class EloquentCtpRepository implements CtpRepository
6
-{
5
+class EloquentCtpRepository implements CtpRepository {
7 6
   /*Return Score collections that include:
8 7
    * Player Name
9 8
    * Date
Please login to merge, or discard this patch.