@@ -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() |
@@ -41,7 +41,6 @@ |
||
| 41 | 41 | /** |
| 42 | 42 | * Display the specified resource. |
| 43 | 43 | * |
| 44 | - * @param int $course_id |
|
| 45 | 44 | * @return Response |
| 46 | 45 | */ |
| 47 | 46 | public function show() |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | class HolesController extends \BaseController { |
| 4 | 4 | |
| 5 | 5 | public function __construct(Course $course, Hole $hole) |
| 6 | - { |
|
| 6 | + { |
|
| 7 | 7 | $this->course = $course; |
| 8 | 8 | $this->hole = $hole; |
| 9 | 9 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | /** |
| 14 | 14 | * Display a listing of the resource. |
| 15 | 15 | * |
| 16 | - * @return Response |
|
| 16 | + * @return string |
|
| 17 | 17 | */ |
| 18 | 18 | public function index() |
| 19 | 19 | { |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | class LiveLeaderboardController extends \BaseController { |
| 7 | 7 | |
| 8 | 8 | public function __construct(LeaderboardService $leaderboard) |
| 9 | - { |
|
| 9 | + { |
|
| 10 | 10 | $this->leaderboard = $leaderboard; |
| 11 | 11 | } |
| 12 | 12 | |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | /** |
| 22 | 22 | * Create a new instance of the MatchHandler |
| 23 | 23 | * |
| 24 | - * @param GolfLeague\Storage\Round\RoundRepository $roundRepo |
|
| 24 | + * @param RoundRepository $roundRepo |
|
| 25 | 25 | * @return void |
| 26 | 26 | */ |
| 27 | 27 | public function __construct(RoundRepository $roundRepo) |
@@ -16,8 +16,7 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @author Michael Schmidt |
| 18 | 18 | */ |
| 19 | -class FinalizeHandler |
|
| 20 | -{ |
|
| 19 | +class FinalizeHandler { |
|
| 21 | 20 | /** |
| 22 | 21 | * Create a new instance of the MatchHandler |
| 23 | 22 | * |
@@ -45,15 +44,14 @@ discard block |
||
| 45 | 44 | $i = 1; |
| 46 | 45 | |
| 47 | 46 | $ctpWinners = Ctp::where('match_id', '=', $match->id)->get(); |
| 48 | - foreach($ctpWinners as $key => $ctpWinner){ |
|
| 47 | + foreach($ctpWinners as $key => $ctpWinner) { |
|
| 49 | 48 | $playerExists = $this->recursive_array_search($ctpWinner->player_id, $winningPlayers); |
| 50 | 49 | //if player is already there add money here to other money |
| 51 | - if($playerExists){ |
|
| 50 | + if($playerExists) { |
|
| 52 | 51 | $winningPlayers[$i]['player_id'] = $ctpWinner->player_id; |
| 53 | 52 | $winningPlayers[$i]['money'] = ($ctpWinner->money + $winningPlayers[$playerExists]['money']); |
| 54 | 53 | unset($winningPlayers[$playerExists]); |
| 55 | - } |
|
| 56 | - else { |
|
| 54 | + } else { |
|
| 57 | 55 | $winningPlayers[$i]['player_id'] = $ctpWinner->player_id; |
| 58 | 56 | $winningPlayers[$i]['money'] = $ctpWinner->money; |
| 59 | 57 | } |
@@ -61,15 +59,14 @@ discard block |
||
| 61 | 59 | } |
| 62 | 60 | |
| 63 | 61 | $netWinners = Netwinner::where('match_id', '=', $match->id)->get(); |
| 64 | - foreach($netWinners as $key => $netWinner){ |
|
| 62 | + foreach($netWinners as $key => $netWinner) { |
|
| 65 | 63 | $playerExists = $this->recursive_array_search($netWinner->player_id, $winningPlayers); |
| 66 | 64 | //if player is already there add money here to other money |
| 67 | - if($playerExists){ |
|
| 65 | + if($playerExists) { |
|
| 68 | 66 | $winningPlayers[$i]['player_id'] = $netWinner->player_id; |
| 69 | 67 | $winningPlayers[$i]['money'] = ($netWinner->money + $winningPlayers[$playerExists]['money']); |
| 70 | 68 | unset($winningPlayers[$playerExists]); |
| 71 | - } |
|
| 72 | - else{ |
|
| 69 | + } else { |
|
| 73 | 70 | $winningPlayers[$i]['player_id'] = $netWinner->player_id; |
| 74 | 71 | $winningPlayers[$i]['money'] = $netWinner->money; |
| 75 | 72 | } |
@@ -77,15 +74,14 @@ discard block |
||
| 77 | 74 | } |
| 78 | 75 | |
| 79 | 76 | $grossWinners = Grosswinner::where('match_id', '=', $match->id)->get(); |
| 80 | - foreach($grossWinners as $key => $grossWinner){ |
|
| 77 | + foreach($grossWinners as $key => $grossWinner) { |
|
| 81 | 78 | $playerExists = $this->recursive_array_search($grossWinner->player_id, $winningPlayers); |
| 82 | 79 | //if player is already there add money here to other money |
| 83 | - if($playerExists){ |
|
| 80 | + if($playerExists) { |
|
| 84 | 81 | $winningPlayers[$i]['player_id'] = $grossWinner->player_id; |
| 85 | 82 | $winningPlayers[$i]['money'] = ($grossWinner->money + $winningPlayers[$playerExists]['money']); |
| 86 | 83 | unset($winningPlayers[$playerExists]); |
| 87 | - } |
|
| 88 | - else{ |
|
| 84 | + } else { |
|
| 89 | 85 | $winningPlayers[$i]['player_id'] = $grossWinner->player_id; |
| 90 | 86 | $winningPlayers[$i]['money'] = $grossWinner->money; |
| 91 | 87 | } |
@@ -93,15 +89,14 @@ discard block |
||
| 93 | 89 | } |
| 94 | 90 | |
| 95 | 91 | $skinWinners = Skin::where('match_id', '=', $match->id)->get(); |
| 96 | - foreach($skinWinners as $key => $skinWinner){ |
|
| 92 | + foreach($skinWinners as $key => $skinWinner) { |
|
| 97 | 93 | $playerExists = $this->recursive_array_search($skinWinner->player_id, $winningPlayers); |
| 98 | 94 | //if player is already there add money here to other money |
| 99 | - if($playerExists){ |
|
| 95 | + if($playerExists) { |
|
| 100 | 96 | $winningPlayers[$i]['player_id'] = $skinWinner->player_id; |
| 101 | 97 | $winningPlayers[$i]['money'] = ($skinWinner->money + $winningPlayers[$playerExists]['money']); |
| 102 | 98 | unset($winningPlayers[$playerExists]); |
| 103 | - } |
|
| 104 | - else{ |
|
| 99 | + } else { |
|
| 105 | 100 | $winningPlayers[$i]['player_id'] = $skinWinner->player_id; |
| 106 | 101 | $winningPlayers[$i]['money'] = $skinWinner->money; |
| 107 | 102 | } |
@@ -109,11 +104,11 @@ discard block |
||
| 109 | 104 | } |
| 110 | 105 | |
| 111 | 106 | //Consolidate any multiple instances of a player |
| 112 | - foreach ($winningPlayers as $key => $winningPlayer){ |
|
| 107 | + foreach ($winningPlayers as $key => $winningPlayer) { |
|
| 113 | 108 | array_search($winningPlayer['player_id'], $winningPlayers); |
| 114 | 109 | } |
| 115 | 110 | |
| 116 | - foreach ($winningPlayers as $key => $player){ |
|
| 111 | + foreach ($winningPlayers as $key => $player) { |
|
| 117 | 112 | $currentPlayer = Player::find($player['player_id']); |
| 118 | 113 | $attributes = array( |
| 119 | 114 | "winnings" => $player['money'] |
@@ -135,7 +130,8 @@ discard block |
||
| 135 | 130 | $events->listen('match.finalize', 'GolfLeague\Handlers\FinalizeHandler'); |
| 136 | 131 | } |
| 137 | 132 | |
| 138 | - public function recursive_array_search($needle,$haystack) { |
|
| 133 | + public function recursive_array_search($needle,$haystack) |
|
| 134 | + { |
|
| 139 | 135 | foreach($haystack as $key=>$value) { |
| 140 | 136 | $current_key=$key; |
| 141 | 137 | if($needle===$value || (is_array($value) && $this->recursive_array_search($needle,$value) !== false)) { |
@@ -17,7 +17,6 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * Create a new instance of the MatchHandler |
| 19 | 19 | * |
| 20 | - * @param GolfLeague\Storage\Round\RoundRepository $roundRepo |
|
| 21 | 20 | * @return void |
| 22 | 21 | */ |
| 23 | 22 | public function __construct(HoleScoreRepository $holescoreRepo) |
@@ -28,7 +27,6 @@ discard block |
||
| 28 | 27 | /** |
| 29 | 28 | * Create an initial round for each player after a new match is created |
| 30 | 29 | * |
| 31 | - * @param Match $match |
|
| 32 | 30 | * @return void |
| 33 | 31 | */ |
| 34 | 32 | public function handle($round) |
@@ -12,8 +12,7 @@ discard block |
||
| 12 | 12 | * |
| 13 | 13 | * @author Michael Schmidt |
| 14 | 14 | */ |
| 15 | -class RoundHandler |
|
| 16 | -{ |
|
| 15 | +class RoundHandler { |
|
| 17 | 16 | /** |
| 18 | 17 | * Create a new instance of the MatchHandler |
| 19 | 18 | * |
@@ -34,7 +33,7 @@ discard block |
||
| 34 | 33 | public function handle($round) |
| 35 | 34 | { |
| 36 | 35 | $holes = Hole::where('course_id', '=', $round['course_id'])->get(); |
| 37 | - foreach($holes as $hole){ |
|
| 36 | + foreach($holes as $hole) { |
|
| 38 | 37 | $input = array( |
| 39 | 38 | 'score' => null, |
| 40 | 39 | 'hole_id' => $hole->id, |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * Loads our $matchRepo |
| 17 | 17 | * |
| 18 | - * @param MatchRepository $matchRepo |
|
| 18 | + * @param MatchRepository $matchRoundRepo |
|
| 19 | 19 | * @return MatchService |
| 20 | 20 | */ |
| 21 | 21 | public function __construct(MatchRoundRepository $matchRoundRepo, RoundRepository $roundRepo, MatchRepository $match) |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * Method to get match data from input Match id |
| 34 | 34 | * |
| 35 | - * @param mixed $matchdata |
|
| 35 | + * @param mixed $matchId |
|
| 36 | 36 | * @return JSON object |
| 37 | 37 | */ |
| 38 | 38 | public function getByMatch($matchId) |
@@ -7,8 +7,7 @@ |
||
| 7 | 7 | /** |
| 8 | 8 | * Our MatchService, containing all useful methods for business logic around Matches |
| 9 | 9 | */ |
| 10 | -class MatchRoundService |
|
| 11 | -{ |
|
| 10 | +class MatchRoundService { |
|
| 12 | 11 | // Containing our pokemonRepository to make all our database calls to |
| 13 | 12 | protected $matchRepo; |
| 14 | 13 | |
@@ -21,7 +21,6 @@ |
||
| 21 | 21 | /** |
| 22 | 22 | * Loads our $matchRepo |
| 23 | 23 | * |
| 24 | - * @param MatchRepository $matchRepo |
|
| 25 | 24 | * @return MatchService |
| 26 | 25 | */ |
| 27 | 26 | public function __construct() |
@@ -12,8 +12,7 @@ |
||
| 12 | 12 | /** |
| 13 | 13 | * MoneyService, containing all useful methods for business logic for money relating to a match |
| 14 | 14 | */ |
| 15 | -class MoneyService |
|
| 16 | -{ |
|
| 15 | +class MoneyService { |
|
| 17 | 16 | |
| 18 | 17 | // Containing our matchRepository to make all our database calls |
| 19 | 18 | protected $matchRepo; |
@@ -1,14 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class Single extends Eloquent |
|
| 4 | -{ |
|
| 3 | +class Single extends Eloquent { |
|
| 5 | 4 | public function match() |
| 6 | 5 | { |
| 7 | 6 | return $this->belongsTo('Match'); |
| 8 | 7 | } |
| 9 | 8 | |
| 10 | 9 | public function players() |
| 11 | - { |
|
| 10 | + { |
|
| 12 | 11 | return $this->hasMany('Player'); |
| 13 | 12 | } |
| 14 | 13 | } |
| 15 | 14 | \ No newline at end of file |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | class Game extends Eloquent { |
| 4 | 4 | |
| 5 | 5 | public function winners() |
| 6 | - { |
|
| 6 | + { |
|
| 7 | 7 | return $this->hasMany('Winner'); |
| 8 | 8 | } |
| 9 | 9 | } |
| 10 | 10 | \ No newline at end of file |