Skip to content

Commit

Permalink
GoogleMapsPlaces: check if value "open_now" in "opening_hours" (#1034)
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsu authored and atymic committed Jan 2, 2020
1 parent f10b804 commit d41fe8c
Show file tree
Hide file tree
Showing 3 changed files with 791 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Model/OpeningHours.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class OpeningHours
{
/**
* @var bool
* @var bool|null
*/
private $openNow;

Expand All @@ -35,21 +35,21 @@ class OpeningHours
private $weekdayText;

/**
* @param bool $openNow
* @param array[] $periods
* @param string[] $weekdayText
* @param bool|null $openNow
* @param array[] $periods
* @param string[] $weekdayText
*/
public function __construct(bool $openNow, array $periods, array $weekdayText)
public function __construct($openNow, array $periods, array $weekdayText)
{
$this->openNow = $openNow;
$this->periods = $periods;
$this->weekdayText = $weekdayText;
}

/**
* @return bool
* @return bool|null
*/
public function isOpenNow(): bool
public function isOpenNow()
{
return $this->openNow;
}
Expand All @@ -70,10 +70,10 @@ public function getWeekdayText(): array
return $this->weekdayText;
}

public static function fromResult(Stdclass $openingHours): self
public static function fromResult(stdClass $openingHours): self
{
return new self(
$openingHours->open_now,
$openingHours->open_now ?? null,
$openingHours->periods ?? [],
$openingHours->weekday_text ?? []
);
Expand Down
Loading

0 comments on commit d41fe8c

Please sign in to comment.