Class luya\web\jsonld\OpeningHoursValue
Inheritance | luya\web\jsonld\OpeningHoursValue » luya\web\jsonld\BaseValue |
---|---|
Available since version | 1.0.14 |
Source Code | https://github.com/luyadev/luya/blob/master/core/web/jsonld/OpeningHoursValue.php |
Opening Hours value.
Days: Mo, Tu, We, Th, Fr, Sa, Su. Time: Times are specified using 24:00 time. For example, 3pm is specified as 15:00.
Output: Mo 10:00-23:00, We 11:00-22:00
Public Methods
Method | Description | Defined By |
---|---|---|
getValue() | luya\web\jsonld\OpeningHoursValue | |
setDay() | Set a a value for a day. | luya\web\jsonld\OpeningHoursValue |
Constants
Constant | Value | Description | Defined By |
---|---|---|---|
DAY_FRIDAY | 5 | luya\web\jsonld\OpeningHoursValue | |
DAY_MONDAY | 1 | luya\web\jsonld\OpeningHoursValue | |
DAY_SATURDAY | 6 | luya\web\jsonld\OpeningHoursValue | |
DAY_SUNDAY | 7 | luya\web\jsonld\OpeningHoursValue | |
DAY_THURSDAY | 4 | luya\web\jsonld\OpeningHoursValue | |
DAY_TUESDAY | 2 | luya\web\jsonld\OpeningHoursValue | |
DAY_WEDNESDAY | 3 | luya\web\jsonld\OpeningHoursValue |
Method Details
Set a a value for a day.
setDay(OpeningHoursValue::DAY_MONDAY, ['08:00' => '12:00', '14:00' => '20:00']);
public void setDay ( $name, array $time ) | ||
$name | ||
$time | array |
public function setDay($name, array $time)
{
if (is_numeric($name)) {
if (!array_key_exists($name, $this->_dayMap)) {
throw new InvalidConfigException("The given day numeric value {$name} is not available in the list of valid day values.");
}
$name = $this->_dayMap[$name];
}
if (!array_search($name, $this->_dayMap)) {
throw new InvalidConfigException("The given day {$name} is not in the list of valid day names.");
}
foreach ($time as $from => $to) {
$this->_days[] = "{$name} {$from}-{$to}";
}
}