xref: /webtrees/app/SiteUser.php (revision 497ae1feb24dcf0749a47bcfb9d4ff99cee9f8a9)
1*497ae1feSGreg Roach<?php
2*497ae1feSGreg Roach/**
3*497ae1feSGreg Roach * webtrees: online genealogy
4*497ae1feSGreg Roach * Copyright (C) 2019 webtrees development team
5*497ae1feSGreg Roach * This program is free software: you can redistribute it and/or modify
6*497ae1feSGreg Roach * it under the terms of the GNU General Public License as published by
7*497ae1feSGreg Roach * the Free Software Foundation, either version 3 of the License, or
8*497ae1feSGreg Roach * (at your option) any later version.
9*497ae1feSGreg Roach * This program is distributed in the hope that it will be useful,
10*497ae1feSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
11*497ae1feSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12*497ae1feSGreg Roach * GNU General Public License for more details.
13*497ae1feSGreg Roach * You should have received a copy of the GNU General Public License
14*497ae1feSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
15*497ae1feSGreg Roach */
16*497ae1feSGreg Roachdeclare(strict_types=1);
17*497ae1feSGreg Roach
18*497ae1feSGreg Roachnamespace Fisharebest\Webtrees;
19*497ae1feSGreg Roach
20*497ae1feSGreg Roachuse Fisharebest\Webtrees\Contracts\UserInterface;
21*497ae1feSGreg Roach
22*497ae1feSGreg Roach/**
23*497ae1feSGreg Roach * The site can act as a user, for example to send email.
24*497ae1feSGreg Roach */
25*497ae1feSGreg Roachclass SiteUser implements UserInterface
26*497ae1feSGreg Roach{
27*497ae1feSGreg Roach    /**
28*497ae1feSGreg Roach     * The user‘s internal identifier.
29*497ae1feSGreg Roach     *
30*497ae1feSGreg Roach     * @return int
31*497ae1feSGreg Roach     */
32*497ae1feSGreg Roach    public function id(): int
33*497ae1feSGreg Roach    {
34*497ae1feSGreg Roach        return 0;
35*497ae1feSGreg Roach    }
36*497ae1feSGreg Roach
37*497ae1feSGreg Roach    /**
38*497ae1feSGreg Roach     * The users email address.
39*497ae1feSGreg Roach     *
40*497ae1feSGreg Roach     * @return string
41*497ae1feSGreg Roach     */
42*497ae1feSGreg Roach    public function email(): string
43*497ae1feSGreg Roach    {
44*497ae1feSGreg Roach        return Site::getPreference('SMTP_FROM_NAME', 'no-reply@localhost');
45*497ae1feSGreg Roach    }
46*497ae1feSGreg Roach
47*497ae1feSGreg Roach    /**
48*497ae1feSGreg Roach     * The user‘s real name.
49*497ae1feSGreg Roach     *
50*497ae1feSGreg Roach     * @return string
51*497ae1feSGreg Roach     */
52*497ae1feSGreg Roach    public function realName(): string
53*497ae1feSGreg Roach    {
54*497ae1feSGreg Roach        return 'webtrees';
55*497ae1feSGreg Roach    }
56*497ae1feSGreg Roach
57*497ae1feSGreg Roach    /**
58*497ae1feSGreg Roach     * The user‘s login name.
59*497ae1feSGreg Roach     *
60*497ae1feSGreg Roach     * @return string
61*497ae1feSGreg Roach     */
62*497ae1feSGreg Roach    public function userName(): string
63*497ae1feSGreg Roach    {
64*497ae1feSGreg Roach        return '';
65*497ae1feSGreg Roach    }
66*497ae1feSGreg Roach
67*497ae1feSGreg Roach    /**
68*497ae1feSGreg Roach     * @param string $setting_name
69*497ae1feSGreg Roach     * @param string $default
70*497ae1feSGreg Roach     *
71*497ae1feSGreg Roach     * @return string
72*497ae1feSGreg Roach     */
73*497ae1feSGreg Roach    public function getPreference(string $setting_name, string $default = ''): string
74*497ae1feSGreg Roach    {
75*497ae1feSGreg Roach        return $default;
76*497ae1feSGreg Roach    }
77*497ae1feSGreg Roach
78*497ae1feSGreg Roach    /**
79*497ae1feSGreg Roach     * @param string $setting_name
80*497ae1feSGreg Roach     * @param string $setting_value
81*497ae1feSGreg Roach     *
82*497ae1feSGreg Roach     * @return UserInterface
83*497ae1feSGreg Roach     */
84*497ae1feSGreg Roach    public function setPreference(string $setting_name, string $setting_value): UserInterface
85*497ae1feSGreg Roach    {
86*497ae1feSGreg Roach        return $this;
87*497ae1feSGreg Roach    }
88*497ae1feSGreg Roach}
89