xref: /webtrees/app/NoReplyUser.php (revision d11be7027e34e3121be11cc025421873364403f9)
14c9729fbSGreg Roach<?php
23976b470SGreg Roach
34c9729fbSGreg Roach/**
44c9729fbSGreg Roach * webtrees: online genealogy
5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
64c9729fbSGreg Roach * This program is free software: you can redistribute it and/or modify
74c9729fbSGreg Roach * it under the terms of the GNU General Public License as published by
84c9729fbSGreg Roach * the Free Software Foundation, either version 3 of the License, or
94c9729fbSGreg Roach * (at your option) any later version.
104c9729fbSGreg Roach * This program is distributed in the hope that it will be useful,
114c9729fbSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
124c9729fbSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
134c9729fbSGreg Roach * GNU General Public License for more details.
144c9729fbSGreg Roach * You should have received a copy of the GNU General Public License
1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
164c9729fbSGreg Roach */
17fcfa147eSGreg Roach
184c9729fbSGreg Roachdeclare(strict_types=1);
194c9729fbSGreg Roach
204c9729fbSGreg Roachnamespace Fisharebest\Webtrees;
214c9729fbSGreg Roach
224c9729fbSGreg Roachuse Fisharebest\Webtrees\Contracts\UserInterface;
234c9729fbSGreg Roach
244c9729fbSGreg Roach/**
251f244d77SGreg Roach * A fake user that cannot receive email.
264c9729fbSGreg Roach */
274c9729fbSGreg Roachclass NoReplyUser implements UserInterface
284c9729fbSGreg Roach{
294c9729fbSGreg Roach    /**
304c9729fbSGreg Roach     * The user‘s internal identifier.
314c9729fbSGreg Roach     *
324c9729fbSGreg Roach     * @return int
334c9729fbSGreg Roach     */
344c9729fbSGreg Roach    public function id(): int
354c9729fbSGreg Roach    {
364c9729fbSGreg Roach        return 0;
374c9729fbSGreg Roach    }
384c9729fbSGreg Roach
394c9729fbSGreg Roach    /**
404c9729fbSGreg Roach     * The users email address.
414c9729fbSGreg Roach     *
424c9729fbSGreg Roach     * @return string
434c9729fbSGreg Roach     */
444c9729fbSGreg Roach    public function email(): string
454c9729fbSGreg Roach    {
465bcb0b8dSGreg Roach        $domain = Site::getPreference('SMTP_HELO') ?: 'localhost';
475bcb0b8dSGreg Roach
485bcb0b8dSGreg Roach        return 'no-reply@' . $domain;
494c9729fbSGreg Roach    }
504c9729fbSGreg Roach
514c9729fbSGreg Roach    /**
524c9729fbSGreg Roach     * The user‘s real name.
534c9729fbSGreg Roach     *
544c9729fbSGreg Roach     * @return string
554c9729fbSGreg Roach     */
564c9729fbSGreg Roach    public function realName(): string
574c9729fbSGreg Roach    {
584c9729fbSGreg Roach        return Webtrees::NAME;
594c9729fbSGreg Roach    }
604c9729fbSGreg Roach
614c9729fbSGreg Roach    /**
624c9729fbSGreg Roach     * The user‘s login name.
634c9729fbSGreg Roach     *
644c9729fbSGreg Roach     * @return string
654c9729fbSGreg Roach     */
664c9729fbSGreg Roach    public function userName(): string
674c9729fbSGreg Roach    {
684c9729fbSGreg Roach        return '';
694c9729fbSGreg Roach    }
704c9729fbSGreg Roach
714c9729fbSGreg Roach    /**
724c9729fbSGreg Roach     * @param string $setting_name
734c9729fbSGreg Roach     * @param string $default
744c9729fbSGreg Roach     *
754c9729fbSGreg Roach     * @return string
764c9729fbSGreg Roach     */
774c9729fbSGreg Roach    public function getPreference(string $setting_name, string $default = ''): string
784c9729fbSGreg Roach    {
794c9729fbSGreg Roach        return $default;
804c9729fbSGreg Roach    }
814c9729fbSGreg Roach
824c9729fbSGreg Roach    /**
834c9729fbSGreg Roach     * @param string $setting_name
844c9729fbSGreg Roach     * @param string $setting_value
854c9729fbSGreg Roach     *
867c4add84SGreg Roach     * @return void
874c9729fbSGreg Roach     */
887c4add84SGreg Roach    public function setPreference(string $setting_name, string $setting_value): void
894c9729fbSGreg Roach    {
904c9729fbSGreg Roach    }
914c9729fbSGreg Roach}
92