@@ -4,10 +4,10 @@ discard block |
||
4 | 4 | |
5 | 5 | class PlayersController extends \BaseController { |
6 | 6 | |
7 | - public function __construct(PlayerRepo $player) |
|
8 | - { |
|
9 | - $this->player = $player; |
|
10 | - } |
|
7 | + public function __construct(PlayerRepo $player) |
|
8 | + { |
|
9 | + $this->player = $player; |
|
10 | + } |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Get Data for all players |
@@ -19,58 +19,58 @@ discard block |
||
19 | 19 | return $this->player->all(); |
20 | 20 | } |
21 | 21 | |
22 | - /** |
|
23 | - * Store a newly created resource in storage. |
|
24 | - * |
|
25 | - * @return Response |
|
26 | - */ |
|
27 | - public function store() |
|
28 | - { |
|
22 | + /** |
|
23 | + * Store a newly created resource in storage. |
|
24 | + * |
|
25 | + * @return Response |
|
26 | + */ |
|
27 | + public function store() |
|
28 | + { |
|
29 | 29 | $this->player->create(Input::get('name'), Input::get('handicap')); |
30 | - } |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * Display the specified resource. |
|
34 | - * |
|
35 | - * @param int $id |
|
36 | - * @return Response |
|
37 | - */ |
|
38 | - public function show($id) |
|
39 | - { |
|
40 | - return $this->player->find($id); |
|
41 | - } |
|
32 | + /** |
|
33 | + * Display the specified resource. |
|
34 | + * |
|
35 | + * @param int $id |
|
36 | + * @return Response |
|
37 | + */ |
|
38 | + public function show($id) |
|
39 | + { |
|
40 | + return $this->player->find($id); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * Show the form for editing the specified resource. |
|
45 | - * |
|
46 | - * @param int $id |
|
47 | - * @return Response |
|
48 | - */ |
|
49 | - public function edit() |
|
50 | - { |
|
43 | + /** |
|
44 | + * Show the form for editing the specified resource. |
|
45 | + * |
|
46 | + * @param int $id |
|
47 | + * @return Response |
|
48 | + */ |
|
49 | + public function edit() |
|
50 | + { |
|
51 | 51 | |
52 | - } |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Update the specified resource in storage. |
|
56 | - * |
|
57 | - * @param int $id |
|
58 | - * @return Response |
|
59 | - */ |
|
60 | - public function update($id) |
|
61 | - { |
|
62 | - // |
|
63 | - } |
|
54 | + /** |
|
55 | + * Update the specified resource in storage. |
|
56 | + * |
|
57 | + * @param int $id |
|
58 | + * @return Response |
|
59 | + */ |
|
60 | + public function update($id) |
|
61 | + { |
|
62 | + // |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * Remove the specified resource from storage. |
|
67 | - * |
|
68 | - * @param int $id |
|
69 | - * @return Response |
|
70 | - */ |
|
71 | - public function destroy($id) |
|
72 | - { |
|
73 | - // |
|
74 | - } |
|
65 | + /** |
|
66 | + * Remove the specified resource from storage. |
|
67 | + * |
|
68 | + * @param int $id |
|
69 | + * @return Response |
|
70 | + */ |
|
71 | + public function destroy($id) |
|
72 | + { |
|
73 | + // |
|
74 | + } |
|
75 | 75 | |
76 | 76 | } |
77 | 77 | \ No newline at end of file |
@@ -42,7 +42,6 @@ |
||
42 | 42 | /** |
43 | 43 | * Show the form for editing the specified resource. |
44 | 44 | * |
45 | - * @param int $id |
|
46 | 45 | * @return Response |
47 | 46 | */ |
48 | 47 | public function edit() |
@@ -2,14 +2,14 @@ discard block |
||
2 | 2 | |
3 | 3 | class EnterScoresController extends \BaseController { |
4 | 4 | |
5 | - /** |
|
6 | - * Display a listing of the resource. |
|
7 | - * |
|
8 | - * @return Response |
|
9 | - */ |
|
10 | - public function view() |
|
11 | - { |
|
12 | - /* |
|
5 | + /** |
|
6 | + * Display a listing of the resource. |
|
7 | + * |
|
8 | + * @return Response |
|
9 | + */ |
|
10 | + public function view() |
|
11 | + { |
|
12 | + /* |
|
13 | 13 | foreach (Score::with('player')->get() as $score) { |
14 | 14 | echo $score->player->name . "<br>"; |
15 | 15 | } |
@@ -69,19 +69,19 @@ discard block |
||
69 | 69 | $holescores[$score_id] = Holescore::where('score_id', '=', $scoreId)->get(); |
70 | 70 | } |
71 | 71 | return $scores; |
72 | - } |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
74 | + /** |
|
75 | 75 | |
76 | 76 | /** |
77 | - * Remove the specified resource from storage. |
|
78 | - * |
|
79 | - * @param int $id |
|
80 | - * @return Response |
|
81 | - */ |
|
82 | - public function destroy($id) |
|
83 | - { |
|
84 | - // |
|
85 | - } |
|
77 | + * Remove the specified resource from storage. |
|
78 | + * |
|
79 | + * @param int $id |
|
80 | + * @return Response |
|
81 | + */ |
|
82 | + public function destroy($id) |
|
83 | + { |
|
84 | + // |
|
85 | + } |
|
86 | 86 | |
87 | 87 | } |
88 | 88 | \ No newline at end of file |
@@ -55,17 +55,17 @@ |
||
55 | 55 | //echo $holescore->hole->number . " score = " . $holescore->score ." " . $diff . "<br>"; |
56 | 56 | |
57 | 57 | } |
58 | - echo "Number of holes played by all = " . $count . "<br>"; |
|
59 | - echo "Number of birdies =" . $birdies . " " . round($birdies/$count,2) . "%<br>"; |
|
60 | - echo "Number of pars = " . $pars . " " . round($pars/$count,2) . "%<br>"; |
|
61 | - echo "Number of bogeys =" . $bogeys . " " . round($bogeys/$count,2) . "%<br>"; |
|
62 | - echo "Number of double bogeys = " . $doubleBogeys . " " . round($doubleBogeys/$count,2) . "%<br>"; |
|
63 | - echo "Number of triples =" . $triples . " " . round($triples/$count,2) . "%<br>"; |
|
64 | - echo "Number of others = " . $others . " " . round($others/$count,2) . "%<br>"; |
|
58 | + echo "Number of holes played by all = ".$count."<br>"; |
|
59 | + echo "Number of birdies =".$birdies." ".round($birdies / $count, 2)."%<br>"; |
|
60 | + echo "Number of pars = ".$pars." ".round($pars / $count, 2)."%<br>"; |
|
61 | + echo "Number of bogeys =".$bogeys." ".round($bogeys / $count, 2)."%<br>"; |
|
62 | + echo "Number of double bogeys = ".$doubleBogeys." ".round($doubleBogeys / $count, 2)."%<br>"; |
|
63 | + echo "Number of triples =".$triples." ".round($triples / $count, 2)."%<br>"; |
|
64 | + echo "Number of others = ".$others." ".round($others / $count, 2)."%<br>"; |
|
65 | 65 | exit(); |
66 | 66 | $scores = Score::where('player_id', '=', 2)->orderBy('date', 'desc')->take(20)->get(); |
67 | 67 | |
68 | - foreach( $scores->id as $scoreId) { |
|
68 | + foreach ($scores->id as $scoreId) { |
|
69 | 69 | $holescores[$score_id] = Holescore::where('score_id', '=', $scoreId)->get(); |
70 | 70 | } |
71 | 71 | return $scores; |
@@ -5,9 +5,9 @@ |
||
5 | 5 | class MoneyController extends \BaseController { |
6 | 6 | |
7 | 7 | public function __construct(MoneyService $money) |
8 | - { |
|
9 | - $this->money = $money; |
|
10 | - } |
|
8 | + { |
|
9 | + $this->money = $money; |
|
10 | + } |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Display a listing of the resource. |
@@ -5,7 +5,7 @@ |
||
5 | 5 | class MoneyController extends \BaseController { |
6 | 6 | |
7 | 7 | public function __construct(MoneyService $money) |
8 | - { |
|
8 | + { |
|
9 | 9 | $this->money = $money; |
10 | 10 | } |
11 | 11 |
@@ -6,11 +6,11 @@ discard block |
||
6 | 6 | class BogeyController extends \BaseController { |
7 | 7 | |
8 | 8 | public function __construct(LeagueStatistics $leagueStatistics) |
9 | - { |
|
9 | + { |
|
10 | 10 | $this->leagueStatistics = $leagueStatistics; |
11 | - } |
|
11 | + } |
|
12 | 12 | |
13 | - /** |
|
13 | + /** |
|
14 | 14 | * Display a listing of the resource. |
15 | 15 | * |
16 | 16 | * @return Response |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function show($id) |
31 | 31 | { |
32 | - $results = $this->leagueStatistics->totalBogeys($id); |
|
32 | + $results = $this->leagueStatistics->totalBogeys($id); |
|
33 | 33 | $data['data'] = $results; |
34 | 34 | return $data; |
35 | 35 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | */ |
30 | 30 | public function show($id) |
31 | 31 | { |
32 | - $results = $this->leagueStatistics->totalBogeys($id); |
|
32 | + $results = $this->leagueStatistics->totalBogeys($id); |
|
33 | 33 | $data['data'] = $results; |
34 | 34 | return $data; |
35 | 35 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | class BogeyController extends \BaseController { |
7 | 7 | |
8 | 8 | public function __construct(LeagueStatistics $leagueStatistics) |
9 | - { |
|
9 | + { |
|
10 | 10 | $this->leagueStatistics = $leagueStatistics; |
11 | 11 | } |
12 | 12 |
@@ -5,9 +5,9 @@ |
||
5 | 5 | class LeaderboardController extends \BaseController { |
6 | 6 | |
7 | 7 | public function __construct(LeaderboardRepository $leaderboardRepo) |
8 | - { |
|
9 | - $this->leaderboardRepo = $leaderboardRepo; |
|
10 | - } |
|
8 | + { |
|
9 | + $this->leaderboardRepo = $leaderboardRepo; |
|
10 | + } |
|
11 | 11 | /** |
12 | 12 | * Display a listing of the resource. |
13 | 13 | * |
@@ -5,7 +5,7 @@ |
||
5 | 5 | class LeaderboardController extends \BaseController { |
6 | 6 | |
7 | 7 | public function __construct(LeaderboardRepository $leaderboardRepo) |
8 | - { |
|
8 | + { |
|
9 | 9 | $this->leaderboardRepo = $leaderboardRepo; |
10 | 10 | } |
11 | 11 | /** |
@@ -21,7 +21,6 @@ |
||
21 | 21 | /** |
22 | 22 | * Display the specified resource. |
23 | 23 | * |
24 | - * @param int $id |
|
25 | 24 | * @return Response |
26 | 25 | */ |
27 | 26 | public function show($year) |
@@ -27,7 +27,7 @@ |
||
27 | 27 | public function show($year) |
28 | 28 | { |
29 | 29 | $results = $this->leaderboardRepo->get($year); |
30 | - $newvalue = array_values( (array)$results ); |
|
30 | + $newvalue = array_values((array) $results); |
|
31 | 31 | $data['data'] = $newvalue; |
32 | 32 | return $data; |
33 | 33 | } |
@@ -6,22 +6,22 @@ |
||
6 | 6 | |
7 | 7 | class RoundServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | - public function register() |
|
10 | - { |
|
9 | + public function register() |
|
10 | + { |
|
11 | 11 | |
12 | - } |
|
12 | + } |
|
13 | 13 | |
14 | - /** |
|
15 | - * Boot the Match Events |
|
16 | - * |
|
17 | - * @return void |
|
18 | - */ |
|
19 | - public function boot() |
|
20 | - { |
|
21 | - $this->app->events->subscribe( |
|
22 | - new RoundHandler( |
|
23 | - $this->app->make('GolfLeague\Storage\HoleScore\HoleScoreRepository') |
|
24 | - ) |
|
25 | - ); |
|
26 | - } |
|
14 | + /** |
|
15 | + * Boot the Match Events |
|
16 | + * |
|
17 | + * @return void |
|
18 | + */ |
|
19 | + public function boot() |
|
20 | + { |
|
21 | + $this->app->events->subscribe( |
|
22 | + new RoundHandler( |
|
23 | + $this->app->make('GolfLeague\Storage\HoleScore\HoleScoreRepository') |
|
24 | + ) |
|
25 | + ); |
|
26 | + } |
|
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -4,8 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Support\ServiceProvider; |
6 | 6 | |
7 | -class RoundServiceProvider extends ServiceProvider |
|
8 | -{ |
|
7 | +class RoundServiceProvider extends ServiceProvider { |
|
9 | 8 | public function register() |
10 | 9 | { |
11 | 10 |
@@ -6,22 +6,22 @@ |
||
6 | 6 | |
7 | 7 | class MatchServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | - public function register() |
|
10 | - { |
|
9 | + public function register() |
|
10 | + { |
|
11 | 11 | |
12 | - } |
|
12 | + } |
|
13 | 13 | |
14 | - /** |
|
15 | - * Boot the Match Events |
|
16 | - * |
|
17 | - * @return void |
|
18 | - */ |
|
19 | - public function boot() |
|
20 | - { |
|
21 | - $this->app->events->subscribe( |
|
22 | - new MatchHandler( |
|
23 | - $this->app->make('GolfLeague\Storage\Round\RoundRepository') |
|
24 | - ) |
|
25 | - ); |
|
26 | - } |
|
14 | + /** |
|
15 | + * Boot the Match Events |
|
16 | + * |
|
17 | + * @return void |
|
18 | + */ |
|
19 | + public function boot() |
|
20 | + { |
|
21 | + $this->app->events->subscribe( |
|
22 | + new MatchHandler( |
|
23 | + $this->app->make('GolfLeague\Storage\Round\RoundRepository') |
|
24 | + ) |
|
25 | + ); |
|
26 | + } |
|
27 | 27 | } |
@@ -4,8 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Support\ServiceProvider; |
6 | 6 | |
7 | -class MatchServiceProvider extends ServiceProvider |
|
8 | -{ |
|
7 | +class MatchServiceProvider extends ServiceProvider { |
|
9 | 8 | public function register() |
10 | 9 | { |
11 | 10 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function __construct(RoundRepository $roundRepo, HoleScoreRepository $holescoreRepo) |
25 | 25 | { |
26 | - $this->roundRepo= $roundRepo; |
|
26 | + $this->roundRepo = $roundRepo; |
|
27 | 27 | $this->holescoreRepo = $holescoreRepo; |
28 | 28 | } // End of __construct |
29 | 29 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | // Update score and esc in round table |
39 | 39 | $holescores = $this->holescoreRepo->getByRound($holescore->round_id); |
40 | 40 | $escTotal = 0; |
41 | - foreach($holescores as $hole) { |
|
41 | + foreach ($holescores as $hole) { |
|
42 | 42 | $esc = new EquitableStrokeControl($hole); |
43 | 43 | $escTotal += $esc->calculate(); |
44 | 44 | } |
@@ -13,8 +13,7 @@ |
||
13 | 13 | * |
14 | 14 | * @author Michael Schmidt |
15 | 15 | */ |
16 | -class HoleScoreHandler |
|
17 | -{ |
|
16 | +class HoleScoreHandler { |
|
18 | 17 | /** |
19 | 18 | * Create a new instance of the MatchHandler |
20 | 19 | * |
@@ -15,42 +15,42 @@ |
||
15 | 15 | */ |
16 | 16 | class HoleScoreHandler |
17 | 17 | { |
18 | - /** |
|
19 | - * Create a new instance of the MatchHandler |
|
20 | - * |
|
21 | - * @param GolfLeague\Storage\Round\RoundRepository $roundRepo |
|
22 | - * @return void |
|
23 | - */ |
|
24 | - public function __construct(RoundRepository $roundRepo, HoleScoreRepository $holescoreRepo) |
|
25 | - { |
|
26 | - $this->roundRepo= $roundRepo; |
|
27 | - $this->holescoreRepo = $holescoreRepo; |
|
28 | - } // End of __construct |
|
18 | + /** |
|
19 | + * Create a new instance of the MatchHandler |
|
20 | + * |
|
21 | + * @param GolfLeague\Storage\Round\RoundRepository $roundRepo |
|
22 | + * @return void |
|
23 | + */ |
|
24 | + public function __construct(RoundRepository $roundRepo, HoleScoreRepository $holescoreRepo) |
|
25 | + { |
|
26 | + $this->roundRepo= $roundRepo; |
|
27 | + $this->holescoreRepo = $holescoreRepo; |
|
28 | + } // End of __construct |
|
29 | 29 | |
30 | 30 | |
31 | - public function handle($holescore) |
|
32 | - { |
|
33 | - // Update score and esc in round table |
|
34 | - $holescores = $this->holescoreRepo->getByRound($holescore->round_id); |
|
35 | - $escTotal = 0; |
|
36 | - foreach($holescores as $hole) { |
|
37 | - $esc = new EquitableStrokeControl($hole); |
|
38 | - $escTotal += $esc->calculate(); |
|
39 | - } |
|
40 | - $round = $this->roundRepo->find($holescore->round_id); |
|
41 | - $round->score = $holescores->sum('score'); |
|
42 | - $round->esc = $escTotal; |
|
43 | - $this->roundRepo->update($round); |
|
44 | - } |
|
31 | + public function handle($holescore) |
|
32 | + { |
|
33 | + // Update score and esc in round table |
|
34 | + $holescores = $this->holescoreRepo->getByRound($holescore->round_id); |
|
35 | + $escTotal = 0; |
|
36 | + foreach($holescores as $hole) { |
|
37 | + $esc = new EquitableStrokeControl($hole); |
|
38 | + $escTotal += $esc->calculate(); |
|
39 | + } |
|
40 | + $round = $this->roundRepo->find($holescore->round_id); |
|
41 | + $round->score = $holescores->sum('score'); |
|
42 | + $round->esc = $escTotal; |
|
43 | + $this->roundRepo->update($round); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Register the listeners for the subscriber. |
|
48 | - * |
|
49 | - * @param Illuminate\Events\Dispatcher $events |
|
50 | - * @return array |
|
51 | - */ |
|
52 | - public function subscribe($events) |
|
53 | - { |
|
54 | - $events->listen('eloquent.updated: Holescore', 'GolfLeague\Handlers\HoleScoreHandler'); |
|
55 | - } |
|
46 | + /** |
|
47 | + * Register the listeners for the subscriber. |
|
48 | + * |
|
49 | + * @param Illuminate\Events\Dispatcher $events |
|
50 | + * @return array |
|
51 | + */ |
|
52 | + public function subscribe($events) |
|
53 | + { |
|
54 | + $events->listen('eloquent.updated: Holescore', 'GolfLeague\Handlers\HoleScoreHandler'); |
|
55 | + } |
|
56 | 56 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | /** |
19 | 19 | * Create a new instance of the MatchHandler |
20 | 20 | * |
21 | - * @param GolfLeague\Storage\Round\RoundRepository $roundRepo |
|
21 | + * @param RoundRepository $roundRepo |
|
22 | 22 | * @return void |
23 | 23 | */ |
24 | 24 | public function __construct(RoundRepository $roundRepo, HoleScoreRepository $holescoreRepo) |
@@ -6,43 +6,43 @@ |
||
6 | 6 | |
7 | 7 | class HandlersServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | - public function register() |
|
10 | - { |
|
11 | - |
|
12 | - } |
|
13 | - |
|
14 | - /** |
|
15 | - * Boot the Handler Events |
|
16 | - * |
|
17 | - * @return void |
|
18 | - */ |
|
19 | - public function boot() |
|
20 | - { |
|
21 | - $this->app->events->subscribe( |
|
22 | - new MatchHandler( |
|
23 | - $this->app->make('GolfLeague\Storage\Round\RoundRepository') |
|
24 | - ) |
|
25 | - ); |
|
26 | - |
|
27 | - $this->app->events->subscribe( |
|
28 | - new RoundHandler( |
|
29 | - $this->app->make('GolfLeague\Storage\HoleScore\HoleScoreRepository') |
|
30 | - ) |
|
31 | - ); |
|
32 | - |
|
33 | - $this->app->events->subscribe( |
|
34 | - new FinalizeHandler( |
|
35 | - $this->app->make('GolfLeague\Storage\Round\RoundRepository') |
|
36 | - ) |
|
37 | - ); |
|
38 | - |
|
39 | - $this->app->events->subscribe( |
|
40 | - new HoleScoreHandler( |
|
41 | - $this->app->make('GolfLeague\Storage\Round\RoundRepository'), |
|
42 | - $this->app->make('GolfLeague\Storage\HoleScore\HoleScoreRepository'), |
|
43 | - $this->app->make('GolfLeague\EquitableStrokeControl') |
|
44 | - ) |
|
45 | - ); |
|
46 | - |
|
47 | - } |
|
9 | + public function register() |
|
10 | + { |
|
11 | + |
|
12 | + } |
|
13 | + |
|
14 | + /** |
|
15 | + * Boot the Handler Events |
|
16 | + * |
|
17 | + * @return void |
|
18 | + */ |
|
19 | + public function boot() |
|
20 | + { |
|
21 | + $this->app->events->subscribe( |
|
22 | + new MatchHandler( |
|
23 | + $this->app->make('GolfLeague\Storage\Round\RoundRepository') |
|
24 | + ) |
|
25 | + ); |
|
26 | + |
|
27 | + $this->app->events->subscribe( |
|
28 | + new RoundHandler( |
|
29 | + $this->app->make('GolfLeague\Storage\HoleScore\HoleScoreRepository') |
|
30 | + ) |
|
31 | + ); |
|
32 | + |
|
33 | + $this->app->events->subscribe( |
|
34 | + new FinalizeHandler( |
|
35 | + $this->app->make('GolfLeague\Storage\Round\RoundRepository') |
|
36 | + ) |
|
37 | + ); |
|
38 | + |
|
39 | + $this->app->events->subscribe( |
|
40 | + new HoleScoreHandler( |
|
41 | + $this->app->make('GolfLeague\Storage\Round\RoundRepository'), |
|
42 | + $this->app->make('GolfLeague\Storage\HoleScore\HoleScoreRepository'), |
|
43 | + $this->app->make('GolfLeague\EquitableStrokeControl') |
|
44 | + ) |
|
45 | + ); |
|
46 | + |
|
47 | + } |
|
48 | 48 | } |
49 | 49 | \ No newline at end of file |
@@ -4,8 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Support\ServiceProvider; |
6 | 6 | |
7 | -class HandlersServiceProvider extends ServiceProvider |
|
8 | -{ |
|
7 | +class HandlersServiceProvider extends ServiceProvider { |
|
9 | 8 | public function register() |
10 | 9 | { |
11 | 10 |