business\Business::__construct PHP Method

__construct() public method

Creates a new business.
public __construct ( array $days, Holidays | DateTime[] | null $holidays = null, DateTimeZone $timezone = null )
$days array
$holidays Holidays | DateTime[] | null
$timezone DateTimeZone
    public function __construct(array $days, $holidays = null, \DateTimeZone $timezone = null)
    {
        if (is_array($holidays)) {
            $holidays = new Holidays($holidays);
        } elseif (is_null($holidays)) {
            $holidays = new Holidays();
        } elseif (!$holidays instanceof Holidays) {
            throw new \InvalidArgumentException('The holidays parameter must be an array of \\DateTime objects, an instance of Business\\Holidays or null.');
        }
        $this->setDays($days);
        $this->holidays = $holidays;
        $this->timezone = $timezone ?: new \DateTimeZone(date_default_timezone_get());
    }