xref: /webtrees/app/SiteUser.php (revision 502cab9067673ad571ede842ac467603d7f0fe88)
1497ae1feSGreg Roach<?php
2497ae1feSGreg Roach/**
3497ae1feSGreg Roach * webtrees: online genealogy
4497ae1feSGreg Roach * Copyright (C) 2019 webtrees development team
5497ae1feSGreg Roach * This program is free software: you can redistribute it and/or modify
6497ae1feSGreg Roach * it under the terms of the GNU General Public License as published by
7497ae1feSGreg Roach * the Free Software Foundation, either version 3 of the License, or
8497ae1feSGreg Roach * (at your option) any later version.
9497ae1feSGreg Roach * This program is distributed in the hope that it will be useful,
10497ae1feSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
11497ae1feSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12497ae1feSGreg Roach * GNU General Public License for more details.
13497ae1feSGreg Roach * You should have received a copy of the GNU General Public License
14497ae1feSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
15497ae1feSGreg Roach */
16497ae1feSGreg Roachdeclare(strict_types=1);
17497ae1feSGreg Roach
18497ae1feSGreg Roachnamespace Fisharebest\Webtrees;
19497ae1feSGreg Roach
20497ae1feSGreg Roachuse Fisharebest\Webtrees\Contracts\UserInterface;
21*502cab90SGreg Roachuse Fisharebest\Webtrees\Services\MailService;
22497ae1feSGreg Roach
23497ae1feSGreg Roach/**
24497ae1feSGreg Roach * The site can act as a user, for example to send email.
254c9729fbSGreg Roach *
264c9729fbSGreg Roach * Some SMTP servers insist that this is a real/validated email address.
274c9729fbSGreg Roach * Others are happy to accept no-reply@localhost.
28497ae1feSGreg Roach */
29497ae1feSGreg Roachclass SiteUser implements UserInterface
30497ae1feSGreg Roach{
31497ae1feSGreg Roach    /**
32497ae1feSGreg Roach     * The user‘s internal identifier.
33497ae1feSGreg Roach     *
34497ae1feSGreg Roach     * @return int
35497ae1feSGreg Roach     */
36497ae1feSGreg Roach    public function id(): int
37497ae1feSGreg Roach    {
38497ae1feSGreg Roach        return 0;
39497ae1feSGreg Roach    }
40497ae1feSGreg Roach
41497ae1feSGreg Roach    /**
42497ae1feSGreg Roach     * The users email address.
43497ae1feSGreg Roach     *
44497ae1feSGreg Roach     * @return string
45497ae1feSGreg Roach     */
46497ae1feSGreg Roach    public function email(): string
47497ae1feSGreg Roach    {
48*502cab90SGreg Roach        return '';
49497ae1feSGreg Roach    }
50497ae1feSGreg Roach
51497ae1feSGreg Roach    /**
52497ae1feSGreg Roach     * The user‘s real name.
53497ae1feSGreg Roach     *
54497ae1feSGreg Roach     * @return string
55497ae1feSGreg Roach     */
56497ae1feSGreg Roach    public function realName(): string
57497ae1feSGreg Roach    {
584c9729fbSGreg Roach        return Webtrees::NAME;
59497ae1feSGreg Roach    }
60497ae1feSGreg Roach
61497ae1feSGreg Roach    /**
62497ae1feSGreg Roach     * The user‘s login name.
63497ae1feSGreg Roach     *
64497ae1feSGreg Roach     * @return string
65497ae1feSGreg Roach     */
66497ae1feSGreg Roach    public function userName(): string
67497ae1feSGreg Roach    {
68497ae1feSGreg Roach        return '';
69497ae1feSGreg Roach    }
70497ae1feSGreg Roach
71497ae1feSGreg Roach    /**
72497ae1feSGreg Roach     * @param string $setting_name
73497ae1feSGreg Roach     * @param string $default
74497ae1feSGreg Roach     *
75497ae1feSGreg Roach     * @return string
76497ae1feSGreg Roach     */
77497ae1feSGreg Roach    public function getPreference(string $setting_name, string $default = ''): string
78497ae1feSGreg Roach    {
79497ae1feSGreg Roach        return $default;
80497ae1feSGreg Roach    }
81497ae1feSGreg Roach
82497ae1feSGreg Roach    /**
83497ae1feSGreg Roach     * @param string $setting_name
84497ae1feSGreg Roach     * @param string $setting_value
85497ae1feSGreg Roach     *
86497ae1feSGreg Roach     * @return UserInterface
87497ae1feSGreg Roach     */
88497ae1feSGreg Roach    public function setPreference(string $setting_name, string $setting_value): UserInterface
89497ae1feSGreg Roach    {
90497ae1feSGreg Roach        return $this;
91497ae1feSGreg Roach    }
92497ae1feSGreg Roach}
93