xref: /webtrees/app/Statistics/Repository/BrowserRepository.php (revision 4459dc9a6d0c27769f8135175f3569e4fa287451)
18add1155SRico Sonntag<?php
28add1155SRico Sonntag/**
38add1155SRico Sonntag * webtrees: online genealogy
4242a7862SGreg 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
20*4459dc9aSGreg Roachuse Fisharebest\Webtrees\Carbon;
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    {
34ca52a408SGreg Roach        $format = strtr(I18N::dateFormat(), ['%' => '']);
35ca52a408SGreg Roach
36*4459dc9aSGreg Roach        return Carbon::now()->local()->format($format);
37*4459dc9aSGreg Roach
388add1155SRico Sonntag    }
398add1155SRico Sonntag
408add1155SRico Sonntag    /**
418add1155SRico Sonntag     * @inheritDoc
428add1155SRico Sonntag     */
438add1155SRico Sonntag    public function browserTime(): string
448add1155SRico Sonntag    {
45ca52a408SGreg Roach        $format = strtr(I18N::timeFormat(), ['%' => '']);
46ca52a408SGreg Roach
47*4459dc9aSGreg Roach        return Carbon::now()->local()->format($format);
488add1155SRico Sonntag    }
498add1155SRico Sonntag
508add1155SRico Sonntag    /**
518add1155SRico Sonntag     * @inheritDoc
528add1155SRico Sonntag     */
538add1155SRico Sonntag    public function browserTimezone(): string
548add1155SRico Sonntag    {
55*4459dc9aSGreg Roach        return Carbon::now()->local()->format('T');
568add1155SRico Sonntag    }
578add1155SRico Sonntag}
58