@@ -36,7 +36,7 @@ |
||
| 36 | 36 | $nfl = new NFL(new NFLHttpClient(), new DateTime('now', new DateTimeZone('US/Eastern'))); |
| 37 | 37 | |
| 38 | 38 | try { |
| 39 | - $data = []; |
|
| 39 | + $data = [ ]; |
|
| 40 | 40 | $todayGames = $nfl->getTodayGames(); |
| 41 | 41 | |
| 42 | 42 | if (is_null($todayGames)) { |
@@ -42,12 +42,12 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | return [ |
| 44 | 44 | $abbr, |
| 45 | - $score['pointQ1'], |
|
| 46 | - $score['pointQ2'], |
|
| 47 | - $score['pointQ3'], |
|
| 48 | - $score['pointQ4'], |
|
| 49 | - $score['pointOT'], |
|
| 50 | - $score['pointTotal'], |
|
| 45 | + $score[ 'pointQ1' ], |
|
| 46 | + $score[ 'pointQ2' ], |
|
| 47 | + $score[ 'pointQ3' ], |
|
| 48 | + $score[ 'pointQ4' ], |
|
| 49 | + $score[ 'pointOT' ], |
|
| 50 | + $score[ 'pointTotal' ], |
|
| 51 | 51 | ]; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | $this->printScoreBoardHeader($game); |
| 65 | 65 | |
| 66 | 66 | $this->command->table( |
| 67 | - ['', '1', '2', '3', '4', 'OT', 'T'], |
|
| 67 | + [ '', '1', '2', '3', '4', 'OT', 'T' ], |
|
| 68 | 68 | [ |
| 69 | - $this->buildScoreBoardRow($game->gameSchedule['homeTeamAbbr'], $game->score['homeTeamScore']), |
|
| 70 | - $this->buildScoreBoardRow($game->gameSchedule['visitorTeamAbbr'], $game->score['visitorTeamScore']), |
|
| 69 | + $this->buildScoreBoardRow($game->gameSchedule[ 'homeTeamAbbr' ], $game->score[ 'homeTeamScore' ]), |
|
| 70 | + $this->buildScoreBoardRow($game->gameSchedule[ 'visitorTeamAbbr' ], $game->score[ 'visitorTeamScore' ]), |
|
| 71 | 71 | ] |
| 72 | 72 | ); |
| 73 | 73 | |
@@ -86,9 +86,9 @@ discard block |
||
| 86 | 86 | $this->command->line( |
| 87 | 87 | sprintf( |
| 88 | 88 | '%s VS %s @ %s', |
| 89 | - $game->gameSchedule['homeTeamAbbr'], |
|
| 90 | - $game->gameSchedule['visitorTeamAbbr'], |
|
| 91 | - $game->gameSchedule['site']['siteFullname'] |
|
| 89 | + $game->gameSchedule[ 'homeTeamAbbr' ], |
|
| 90 | + $game->gameSchedule[ 'visitorTeamAbbr' ], |
|
| 91 | + $game->gameSchedule[ 'site' ][ 'siteFullname' ] |
|
| 92 | 92 | ) |
| 93 | 93 | ); |
| 94 | 94 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $this->command->line(sprintf( |
| 97 | 97 | '%s | %s | %s %s', |
| 98 | 98 | $game->getCurrentQuarter(), |
| 99 | - $game->score['time'], |
|
| 99 | + $game->score[ 'time' ], |
|
| 100 | 100 | $game->getPossesionTeam(), |
| 101 | 101 | $game->getCurrentDown() |
| 102 | 102 | )); |
@@ -112,19 +112,19 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public function renderGamesList(?GenericList $gameCollection): void |
| 114 | 114 | { |
| 115 | - $data = []; |
|
| 115 | + $data = [ ]; |
|
| 116 | 116 | |
| 117 | - $gameCollection->forEach(function ($game, $key) use (&$data) { |
|
| 117 | + $gameCollection->forEach(function($game, $key) use (&$data) { |
|
| 118 | 118 | array_push($data, [ |
| 119 | - $game->gameSchedule['homeTeamAbbr'], |
|
| 120 | - $game->gameSchedule['visitorTeamAbbr'], |
|
| 121 | - $game->gameSchedule['site']['siteFullname'], |
|
| 122 | - $game->gameSchedule['gameDate'], |
|
| 123 | - sprintf('%s ET', $game->gameSchedule['gameTimeEastern']), |
|
| 119 | + $game->gameSchedule[ 'homeTeamAbbr' ], |
|
| 120 | + $game->gameSchedule[ 'visitorTeamAbbr' ], |
|
| 121 | + $game->gameSchedule[ 'site' ][ 'siteFullname' ], |
|
| 122 | + $game->gameSchedule[ 'gameDate' ], |
|
| 123 | + sprintf('%s ET', $game->gameSchedule[ 'gameTimeEastern' ]), |
|
| 124 | 124 | ]); |
| 125 | 125 | }); |
| 126 | 126 | |
| 127 | - $this->command->table(['Home', 'Visitor', 'Stadium', 'Date', 'Hour'], $data); |
|
| 127 | + $this->command->table([ 'Home', 'Visitor', 'Stadium', 'Date', 'Hour' ], $data); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | exit($this->command->line('Sorry, there is no games right now.')); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - $games->forEach(function ($game, $key) { |
|
| 144 | + $games->forEach(function($game, $key) { |
|
| 145 | 145 | $this->printScoreBoard($game); |
| 146 | 146 | }); |
| 147 | 147 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | public function __get(string $name) |
| 41 | 41 | { |
| 42 | 42 | if (array_key_exists($name, $this->data)) { |
| 43 | - return $this->data[$name]; |
|
| 43 | + return $this->data[ $name ]; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | throw new NonExistingPropertyException(sprintf('There is not property called %s in this object', $name)); |
@@ -54,15 +54,15 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function getCurrentDown(): ?string |
| 56 | 56 | { |
| 57 | - if ($this->score['down'] === 0) { |
|
| 57 | + if ($this->score[ 'down' ] === 0) { |
|
| 58 | 58 | return null; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | return sprintf( |
| 62 | 62 | '%d%s & %d', |
| 63 | - $this->score['down'], |
|
| 64 | - getOrdinalSuffix($this->score['down']), |
|
| 65 | - $this->score['yardsToGo'] |
|
| 63 | + $this->score[ 'down' ], |
|
| 64 | + getOrdinalSuffix($this->score[ 'down' ]), |
|
| 65 | + $this->score[ 'yardsToGo' ] |
|
| 66 | 66 | ); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function getPossesionTeam(): ?string |
| 77 | 77 | { |
| 78 | - return !$this->isFinished() ? $this->score['possessionTeamAbbr'] : null; |
|
| 78 | + return !$this->isFinished() ? $this->score[ 'possessionTeamAbbr' ] : null; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function getCurrentQuarter(): ?string |
| 88 | 88 | { |
| 89 | - return $this->score['phaseDescription']; |
|
| 89 | + return $this->score[ 'phaseDescription' ]; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public function isFinished(): bool |
| 99 | 99 | { |
| 100 | - return in_array($this->score['phase'], ['FINAL', 'FINAL OVERTIME']); |
|
| 100 | + return in_array($this->score[ 'phase' ], [ 'FINAL', 'FINAL OVERTIME' ]); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -108,6 +108,6 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function isSuspended(): bool |
| 110 | 110 | { |
| 111 | - return $this->score['phase'] === 'SUSPENDED'; |
|
| 111 | + return $this->score[ 'phase' ] === 'SUSPENDED'; |
|
| 112 | 112 | } |
| 113 | 113 | } |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function getFinishedGames(): ?GenericList |
| 51 | 51 | { |
| 52 | - return $this->getTodayGames()->filter(function ($key, $game) { |
|
| 53 | - return in_array($game->score['phase'], ['FINAL', 'FINAL OVERTIME']); |
|
| 52 | + return $this->getTodayGames()->filter(function($key, $game) { |
|
| 53 | + return in_array($game->score[ 'phase' ], [ 'FINAL', 'FINAL OVERTIME' ]); |
|
| 54 | 54 | }); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -65,9 +65,9 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function getFinishedGameByTeam(string $team): ?GenericList |
| 67 | 67 | { |
| 68 | - return $this->getFinishedGames()->filter(function ($key, $game) use ($team) { |
|
| 69 | - return $game->gameSchedule['homeTeamAbbr'] === $team || |
|
| 70 | - $game->gameSchedule['visitorTeamAbbr'] === $team; |
|
| 68 | + return $this->getFinishedGames()->filter(function($key, $game) use ($team) { |
|
| 69 | + return $game->gameSchedule[ 'homeTeamAbbr' ] === $team || |
|
| 70 | + $game->gameSchedule[ 'visitorTeamAbbr' ] === $team; |
|
| 71 | 71 | }); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function getLiveGames(): ?GenericList |
| 83 | 83 | { |
| 84 | - return $this->getWeekGames()->filter(function ($key, $game) { |
|
| 85 | - return !in_array($game->score['phase'], ['FINAL', 'SUSPENDED', 'FINAL OVERTIME', null]); |
|
| 84 | + return $this->getWeekGames()->filter(function($key, $game) { |
|
| 85 | + return !in_array($game->score[ 'phase' ], [ 'FINAL', 'SUSPENDED', 'FINAL OVERTIME', null ]); |
|
| 86 | 86 | }); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -97,9 +97,9 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public function getLiveGameByTeam(string $team): ?GenericList |
| 99 | 99 | { |
| 100 | - return $this->getLiveGames()->filter(function ($key, $game) use ($team) { |
|
| 101 | - return $game->gameSchedule['homeTeamAbbr'] === $team || |
|
| 102 | - $game->gameSchedule['visitorTeamAbbr'] === $team; |
|
| 100 | + return $this->getLiveGames()->filter(function($key, $game) use ($team) { |
|
| 101 | + return $game->gameSchedule[ 'homeTeamAbbr' ] === $team || |
|
| 102 | + $game->gameSchedule[ 'visitorTeamAbbr' ] === $team; |
|
| 103 | 103 | }); |
| 104 | 104 | } |
| 105 | 105 | |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function getTodayGames(): ?GenericList |
| 113 | 113 | { |
| 114 | - return $this->getWeekGames()->filter(function ($key, $game) { |
|
| 115 | - return str_replace('\/', '/', $game->gameSchedule['gameDate']) === $this->today->format('m/d/Y'); |
|
| 114 | + return $this->getWeekGames()->filter(function($key, $game) { |
|
| 115 | + return str_replace('\/', '/', $game->gameSchedule[ 'gameDate' ]) === $this->today->format('m/d/Y'); |
|
| 116 | 116 | }); |
| 117 | 117 | } |
| 118 | 118 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $data = $this->client->get($this->client->getUrl()); |
| 133 | 133 | $parsedData = JSONParser::parse($data); |
| 134 | 134 | |
| 135 | - foreach ($parsedData['gameScores'] as $key => $gameData) { |
|
| 135 | + foreach ($parsedData[ 'gameScores' ] as $key => $gameData) { |
|
| 136 | 136 | $games->add(new Game($gameData)); |
| 137 | 137 | } |
| 138 | 138 | |