xref: /webtrees/app/Module/ModuleAnalyticsInterface.php (revision d11be7027e34e3121be11cc025421873364403f9)
137eb8894SGreg Roach<?php
23976b470SGreg Roach
337eb8894SGreg Roach/**
437eb8894SGreg Roach * webtrees: online genealogy
5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
637eb8894SGreg Roach * This program is free software: you can redistribute it and/or modify
737eb8894SGreg Roach * it under the terms of the GNU General Public License as published by
837eb8894SGreg Roach * the Free Software Foundation, either version 3 of the License, or
937eb8894SGreg Roach * (at your option) any later version.
1037eb8894SGreg Roach * This program is distributed in the hope that it will be useful,
1137eb8894SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
1237eb8894SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1337eb8894SGreg Roach * GNU General Public License for more details.
1437eb8894SGreg 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/>.
1637eb8894SGreg Roach */
17fcfa147eSGreg Roach
1837eb8894SGreg Roachdeclare(strict_types=1);
1937eb8894SGreg Roach
2037eb8894SGreg Roachnamespace Fisharebest\Webtrees\Module;
2137eb8894SGreg Roach
226ccdf4f0SGreg Roachuse Psr\Http\Message\ResponseInterface;
236ccdf4f0SGreg Roachuse Psr\Http\Message\ServerRequestInterface;
248e5c5efeSGreg Roach
2537eb8894SGreg Roach/**
2637eb8894SGreg Roach * Interface ModuleAnalyticsInterface - Classes and libraries for module system
2737eb8894SGreg Roach */
2837eb8894SGreg Roachinterface ModuleAnalyticsInterface extends ModuleInterface
2937eb8894SGreg Roach{
3037eb8894SGreg Roach    /**
3137eb8894SGreg Roach     * Should we add this tracker?
3237eb8894SGreg Roach     *
3337eb8894SGreg Roach     * @return bool
3437eb8894SGreg Roach     */
3537eb8894SGreg Roach    public function analyticsCanShow(): bool;
3637eb8894SGreg Roach
3737eb8894SGreg Roach    /**
3837eb8894SGreg Roach     * Form fields to edit the parameters.
3937eb8894SGreg Roach     *
4037eb8894SGreg Roach     * @return string
4137eb8894SGreg Roach     */
4237eb8894SGreg Roach    public function analyticsFormFields(): string;
4337eb8894SGreg Roach
4437eb8894SGreg Roach    /**
4537eb8894SGreg Roach     * The parameters that need to be embedded in the snippet.
4637eb8894SGreg Roach     *
4724f2a3afSGreg Roach     * @return array<string>
4837eb8894SGreg Roach     */
4937eb8894SGreg Roach    public function analyticsParameters(): array;
5037eb8894SGreg Roach
5137eb8894SGreg Roach    /**
5237eb8894SGreg Roach     * Embed placeholders in the snippet.
5337eb8894SGreg Roach     *
5409482a55SGreg Roach     * @param array<string> $parameters
5537eb8894SGreg Roach     *
5637eb8894SGreg Roach     * @return string
5737eb8894SGreg Roach     */
5837eb8894SGreg Roach    public function analyticsSnippet(array $parameters): string;
598e5c5efeSGreg Roach
608e5c5efeSGreg Roach    /**
61b3a775f6SGreg Roach     * Is this a tracker, as opposed to just a site-verification.
62b3a775f6SGreg Roach     *
63b3a775f6SGreg Roach     * @return bool
64b3a775f6SGreg Roach     */
65b3a775f6SGreg Roach    public function isTracker(): bool;
66b3a775f6SGreg Roach
67b3a775f6SGreg Roach    /**
6857ab2231SGreg Roach     * @param ServerRequestInterface $request
6957ab2231SGreg Roach     *
706ccdf4f0SGreg Roach     * @return ResponseInterface
718e5c5efeSGreg Roach     */
7257ab2231SGreg Roach    public function getAdminAction(ServerRequestInterface $request): ResponseInterface;
738e5c5efeSGreg Roach
748e5c5efeSGreg Roach    /**
756ccdf4f0SGreg Roach     * @param ServerRequestInterface $request
768e5c5efeSGreg Roach     *
776ccdf4f0SGreg Roach     * @return ResponseInterface
788e5c5efeSGreg Roach     */
796ccdf4f0SGreg Roach    public function postAdminAction(ServerRequestInterface $request): ResponseInterface;
8037eb8894SGreg Roach}
81