Skip to content

Commit

Permalink
feat: add null validation
Browse files Browse the repository at this point in the history
  • Loading branch information
flavin27 committed Feb 18, 2024
1 parent ec15d37 commit 5ad656c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Scraper.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private function processPrato(string $texto_corrigido, string $dia, string $data
public function getCardapioDia(int $dia): array
{
$cardapio = $this->scrape_data();
if (count($cardapio) === 0) {
if (count($cardapio) === 0 || $dia < 0 || $dia > 4 || !isset($cardapio[$dia])) {
return [];
}

Expand Down Expand Up @@ -170,9 +170,8 @@ public function normalizeSpaces(array $cardapio): array

}

$cliet = new Scraper();
$cliet->scrape_data();
var_dump($cliet->getCardapioDia(0));





Expand Down

0 comments on commit 5ad656c

Please sign in to comment.