@@ -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() |
@@ -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 | { |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | $type = $id; |
| 56 | 56 | |
| 57 | 57 | //return net or gross leaderboard for live scoring |
| 58 | - $data['data'] = $this->leaderboard->calculate($match,$type); |
|
| 58 | + $data['data'] = $this->leaderboard->calculate($match, $type); |
|
| 59 | 59 | return $data; |
| 60 | 60 | |
| 61 | 61 | } |
@@ -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) |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function __construct(RoundRepository $roundRepo) |
| 28 | 28 | { |
| 29 | - $this->roundRepo= $roundRepo; |
|
| 29 | + $this->roundRepo = $roundRepo; |
|
| 30 | 30 | } // End of __construct |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | $i = 1; |
| 46 | 46 | |
| 47 | 47 | $ctpWinners = Ctp::where('match_id', '=', $match->id)->get(); |
| 48 | - foreach($ctpWinners as $key => $ctpWinner){ |
|
| 48 | + foreach ($ctpWinners as $key => $ctpWinner) { |
|
| 49 | 49 | $playerExists = $this->recursive_array_search($ctpWinner->player_id, $winningPlayers); |
| 50 | 50 | //if player is already there add money here to other money |
| 51 | - if($playerExists){ |
|
| 51 | + if ($playerExists) { |
|
| 52 | 52 | $winningPlayers[$i]['player_id'] = $ctpWinner->player_id; |
| 53 | 53 | $winningPlayers[$i]['money'] = ($ctpWinner->money + $winningPlayers[$playerExists]['money']); |
| 54 | 54 | unset($winningPlayers[$playerExists]); |
@@ -61,15 +61,15 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $netWinners = Netwinner::where('match_id', '=', $match->id)->get(); |
| 64 | - foreach($netWinners as $key => $netWinner){ |
|
| 64 | + foreach ($netWinners as $key => $netWinner) { |
|
| 65 | 65 | $playerExists = $this->recursive_array_search($netWinner->player_id, $winningPlayers); |
| 66 | 66 | //if player is already there add money here to other money |
| 67 | - if($playerExists){ |
|
| 67 | + if ($playerExists) { |
|
| 68 | 68 | $winningPlayers[$i]['player_id'] = $netWinner->player_id; |
| 69 | 69 | $winningPlayers[$i]['money'] = ($netWinner->money + $winningPlayers[$playerExists]['money']); |
| 70 | 70 | unset($winningPlayers[$playerExists]); |
| 71 | 71 | } |
| 72 | - else{ |
|
| 72 | + else { |
|
| 73 | 73 | $winningPlayers[$i]['player_id'] = $netWinner->player_id; |
| 74 | 74 | $winningPlayers[$i]['money'] = $netWinner->money; |
| 75 | 75 | } |
@@ -77,15 +77,15 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $grossWinners = Grosswinner::where('match_id', '=', $match->id)->get(); |
| 80 | - foreach($grossWinners as $key => $grossWinner){ |
|
| 80 | + foreach ($grossWinners as $key => $grossWinner) { |
|
| 81 | 81 | $playerExists = $this->recursive_array_search($grossWinner->player_id, $winningPlayers); |
| 82 | 82 | //if player is already there add money here to other money |
| 83 | - if($playerExists){ |
|
| 83 | + if ($playerExists) { |
|
| 84 | 84 | $winningPlayers[$i]['player_id'] = $grossWinner->player_id; |
| 85 | 85 | $winningPlayers[$i]['money'] = ($grossWinner->money + $winningPlayers[$playerExists]['money']); |
| 86 | 86 | unset($winningPlayers[$playerExists]); |
| 87 | 87 | } |
| 88 | - else{ |
|
| 88 | + else { |
|
| 89 | 89 | $winningPlayers[$i]['player_id'] = $grossWinner->player_id; |
| 90 | 90 | $winningPlayers[$i]['money'] = $grossWinner->money; |
| 91 | 91 | } |
@@ -93,15 +93,15 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | $skinWinners = Skin::where('match_id', '=', $match->id)->get(); |
| 96 | - foreach($skinWinners as $key => $skinWinner){ |
|
| 96 | + foreach ($skinWinners as $key => $skinWinner) { |
|
| 97 | 97 | $playerExists = $this->recursive_array_search($skinWinner->player_id, $winningPlayers); |
| 98 | 98 | //if player is already there add money here to other money |
| 99 | - if($playerExists){ |
|
| 99 | + if ($playerExists) { |
|
| 100 | 100 | $winningPlayers[$i]['player_id'] = $skinWinner->player_id; |
| 101 | 101 | $winningPlayers[$i]['money'] = ($skinWinner->money + $winningPlayers[$playerExists]['money']); |
| 102 | 102 | unset($winningPlayers[$playerExists]); |
| 103 | 103 | } |
| 104 | - else{ |
|
| 104 | + else { |
|
| 105 | 105 | $winningPlayers[$i]['player_id'] = $skinWinner->player_id; |
| 106 | 106 | $winningPlayers[$i]['money'] = $skinWinner->money; |
| 107 | 107 | } |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | //Consolidate any multiple instances of a player |
| 112 | - foreach ($winningPlayers as $key => $winningPlayer){ |
|
| 112 | + foreach ($winningPlayers as $key => $winningPlayer) { |
|
| 113 | 113 | array_search($winningPlayer['player_id'], $winningPlayers); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - foreach ($winningPlayers as $key => $player){ |
|
| 116 | + foreach ($winningPlayers as $key => $player) { |
|
| 117 | 117 | $currentPlayer = Player::find($player['player_id']); |
| 118 | 118 | $attributes = array( |
| 119 | 119 | "winnings" => $player['money'] |
@@ -135,10 +135,10 @@ discard block |
||
| 135 | 135 | $events->listen('match.finalize', 'GolfLeague\Handlers\FinalizeHandler'); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - public function recursive_array_search($needle,$haystack) { |
|
| 139 | - foreach($haystack as $key=>$value) { |
|
| 140 | - $current_key=$key; |
|
| 141 | - if($needle===$value || (is_array($value) && $this->recursive_array_search($needle,$value) !== false)) { |
|
| 138 | + public function recursive_array_search($needle, $haystack) { |
|
| 139 | + foreach ($haystack as $key=>$value) { |
|
| 140 | + $current_key = $key; |
|
| 141 | + if ($needle === $value || (is_array($value) && $this->recursive_array_search($needle, $value) !== false)) { |
|
| 142 | 142 | return $current_key; |
| 143 | 143 | } |
| 144 | 144 | } |
@@ -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) |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function __construct(HoleScoreRepository $holescoreRepo) |
| 24 | 24 | { |
| 25 | - $this->holescoreRepo= $holescoreRepo; |
|
| 25 | + $this->holescoreRepo = $holescoreRepo; |
|
| 26 | 26 | } // End of __construct |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | public function handle($round) |
| 35 | 35 | { |
| 36 | 36 | $holes = Hole::where('course_id', '=', $round['course_id'])->get(); |
| 37 | - foreach($holes as $hole){ |
|
| 37 | + foreach ($holes as $hole) { |
|
| 38 | 38 | $input = array( |
| 39 | 39 | 'score' => null, |
| 40 | 40 | '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) |
@@ -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() |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | public function totalMatchMoney($matchId) |
| 33 | 33 | { |
| 34 | 34 | //get player id and money for ctp |
| 35 | - $results['ctps'] = Ctp::with('player')->where('match_id', '=', $matchId)->get(); |
|
| 35 | + $results['ctps'] = Ctp::with('player')->where('match_id', '=', $matchId)->get(); |
|
| 36 | 36 | $results['skins'] = Skin::with('player', 'hole')->where('match_id', '=', $matchId)->get(); |
| 37 | 37 | $results['netwinner'] = Netwinner::with('player')->where('match_id', '=', $matchId)->get(); |
| 38 | 38 | $results['grosswinner'] = Grosswinner::with('player')->where('match_id', '=', $matchId)->get(); |
@@ -14,6 +14,6 @@ |
||
| 14 | 14 | |
| 15 | 15 | public function courses() |
| 16 | 16 | { |
| 17 | - return $this->hasManyThrough('Course','Holescore'); |
|
| 17 | + return $this->hasManyThrough('Course', 'Holescore'); |
|
| 18 | 18 | } |
| 19 | 19 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | public function holescores() |
| 12 | 12 | { |
| 13 | - return $this->hasManyThrough('Holescore','Round'); |
|
| 13 | + return $this->hasManyThrough('Holescore', 'Round'); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function skins() |