xref: /webtrees/app/Statistics/Repository/BrowserRepository.php (revision 242a78626998a767db1568b24919e94ae4b38ac3)
18add1155SRico Sonntag<?php
28add1155SRico Sonntag/**
38add1155SRico Sonntag * webtrees: online genealogy
4*242a7862SGreg Roach * Copyright (C) 2019 webtrees development team
58add1155SRico Sonntag * This program is free software: you can redistribute it and/or modify
68add1155SRico Sonntag * it under the terms of the GNU General Public License as published by
78add1155SRico Sonntag * the Free Software Foundation, either version 3 of the License, or
88add1155SRico Sonntag * (at your option) any later version.
98add1155SRico Sonntag * This program is distributed in the hope that it will be useful,
108add1155SRico Sonntag * but WITHOUT ANY WARRANTY; without even the implied warranty of
118add1155SRico Sonntag * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
128add1155SRico Sonntag * GNU General Public License for more details.
138add1155SRico Sonntag * You should have received a copy of the GNU General Public License
148add1155SRico Sonntag * along with this program. If not, see <http://www.gnu.org/licenses/>.
158add1155SRico Sonntag */
168add1155SRico Sonntagdeclare(strict_types=1);
178add1155SRico Sonntag
188add1155SRico Sonntagnamespace Fisharebest\Webtrees\Statistics\Repository;
198add1155SRico Sonntag
208add1155SRico Sonntaguse Fisharebest\Webtrees\Functions\FunctionsDate;
218add1155SRico Sonntaguse Fisharebest\Webtrees\I18N;
228add1155SRico Sonntaguse Fisharebest\Webtrees\Statistics\Repository\Interfaces\BrowserRepositoryInterface;
238add1155SRico Sonntag
248add1155SRico Sonntag/**
258add1155SRico Sonntag * A repository providing methods for browser related statistics.
268add1155SRico Sonntag */
278add1155SRico Sonntagclass BrowserRepository implements BrowserRepositoryInterface
288add1155SRico Sonntag{
298add1155SRico Sonntag    /**
308add1155SRico Sonntag     * @inheritDoc
318add1155SRico Sonntag     */
328add1155SRico Sonntag    public function browserDate(): string
338add1155SRico Sonntag    {
348add1155SRico Sonntag        // TODO: Duplicates ServerRepository::serverDate
358add1155SRico Sonntag        return FunctionsDate::timestampToGedcomDate(WT_TIMESTAMP)->display();
368add1155SRico Sonntag    }
378add1155SRico Sonntag
388add1155SRico Sonntag    /**
398add1155SRico Sonntag     * @inheritDoc
408add1155SRico Sonntag     */
418add1155SRico Sonntag    public function browserTime(): string
428add1155SRico Sonntag    {
438add1155SRico Sonntag        return date(
448add1155SRico Sonntag            str_replace('%', '', I18N::timeFormat()),
458add1155SRico Sonntag            WT_TIMESTAMP + WT_TIMESTAMP_OFFSET
468add1155SRico Sonntag        );
478add1155SRico Sonntag    }
488add1155SRico Sonntag
498add1155SRico Sonntag    /**
508add1155SRico Sonntag     * @inheritDoc
518add1155SRico Sonntag     */
528add1155SRico Sonntag    public function browserTimezone(): string
538add1155SRico Sonntag    {
548add1155SRico Sonntag        return date('T', WT_TIMESTAMP + WT_TIMESTAMP_OFFSET);
558add1155SRico Sonntag    }
568add1155SRico Sonntag}
57