1*d97083feSGreg Roach<?php 2*d97083feSGreg Roach 3*d97083feSGreg Roach/** 4*d97083feSGreg Roach * webtrees: online genealogy 5*d97083feSGreg Roach * Copyright (C) 2021 webtrees development team 6*d97083feSGreg Roach * This program is free software: you can redistribute it and/or modify 7*d97083feSGreg Roach * it under the terms of the GNU General Public License as published by 8*d97083feSGreg Roach * the Free Software Foundation, either version 3 of the License, or 9*d97083feSGreg Roach * (at your option) any later version. 10*d97083feSGreg Roach * This program is distributed in the hope that it will be useful, 11*d97083feSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 12*d97083feSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13*d97083feSGreg Roach * GNU General Public License for more details. 14*d97083feSGreg Roach * You should have received a copy of the GNU General Public License 15*d97083feSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>. 16*d97083feSGreg Roach */ 17*d97083feSGreg Roach 18*d97083feSGreg Roachdeclare(strict_types=1); 19*d97083feSGreg Roach 20*d97083feSGreg Roachnamespace Fisharebest\Webtrees\Contracts; 21*d97083feSGreg Roach 22*d97083feSGreg Roach/** 23*d97083feSGreg Roach * Create a timestamp object. 24*d97083feSGreg Roach */ 25*d97083feSGreg Roachinterface TimestampFactoryInterface 26*d97083feSGreg Roach{ 27*d97083feSGreg Roach /** 28*d97083feSGreg Roach * @param int $timestamp 29*d97083feSGreg Roach * @param UserInterface|null $user 30*d97083feSGreg Roach * 31*d97083feSGreg Roach * @return TimestampInterface 32*d97083feSGreg Roach */ 33*d97083feSGreg Roach public function make(int $timestamp, UserInterface $user = null): TimestampInterface; 34*d97083feSGreg Roach 35*d97083feSGreg Roach /** 36*d97083feSGreg Roach * @param string|null $string YYYY-MM-DD HH:MM:SS (as provided by SQL). 37*d97083feSGreg Roach * @param string $format 38*d97083feSGreg Roach * @param UserInterface|null $user 39*d97083feSGreg Roach * 40*d97083feSGreg Roach * @return TimestampInterface 41*d97083feSGreg Roach */ 42*d97083feSGreg Roach public function fromString(?string $string, string $format = 'Y-m-d H:i:s', UserInterface $user = null): TimestampInterface; 43*d97083feSGreg Roach 44*d97083feSGreg Roach /** 45*d97083feSGreg Roach * @param UserInterface|null $user 46*d97083feSGreg Roach * 47*d97083feSGreg Roach * @return TimestampInterface 48*d97083feSGreg Roach */ 49*d97083feSGreg Roach public function now(UserInterface $user = null): TimestampInterface; 50*d97083feSGreg Roach} 51