germania-kg/opening-hours

Interfaces and implementation for Opening Hours and Times

1.1.5 2022-06-28 11:30 UTC

This package is auto-updated.

Last update: 2024-11-28 16:59:17 UTC


README

Germania KG ยท Opening Hours

Packagist PHP version Build Status Scrutinizer Code Quality Code Coverage Build Status

Installation with Composer

$ composer require germania-kg/opening-hours

Usage

OpeningTimesInterface

interface Germania\OpeningTimes\OpeningTimesInterface

// Textual description regarding the opening times
public function getDescription() : ?string;
public function setDescription( string $text = null);

// Set information for certain days
public function getDay( string $day ) : ?string;
public function setDay( string $day, string $times = null );

// Common day interceptors, getter and setter
public function getMonday()    : ?string;
public function getTuesday()   : ?string;
public function getWednesday() : ?string;
public function getThursday()  : ?string;
public function getFriday()    : ?string;
public function getSaturday()  : ?string;
public function getSunday()    : ?string;  

Class OpeningTimes

use Germania\OpeningTimes\OpeningTimes;

$open = new OpeningTimes;

$open->setDescription("nach Vereinbarung");
$open->getDescription(); // "nach Vereinbarung"

$open->setDay("monday", "09 to 18");
$open->getDay("monday"); // "09 to 18"

$open->getMonday(); // null
echo $open->setMonday("whole day")->getMonday(); // "whole day"

// and also these Setters:
// - setMonday()
// - setTuesday()
// - setWednesday()
// - setThursday()
// - setFriday()
// - setSaturday()
// - setSunday()

Issues

See full issues list.

Roadmap

Fill in planned or desired features

Development

$ git clone https://github.com/GermaniaKG/OpeningTimes.git
$ cd OpeningTimes
$ composer install

Unit tests

Either copy phpunit.xml.dist to phpunit.xml and adapt to your needs, or leave as is. Run PhpUnit test or composer scripts like this:

$ composer test
# or
$ vendor/bin/phpunit