]> git.mxchange.org Git - friendica.git/blob - src/Federation/Factory/GServer.php
Function is renamed
[friendica.git] / src / Federation / Factory / GServer.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2010-2023, the Friendica project
4  *
5  * @license GNU AGPL version 3 or any later version
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Affero General Public License for more details.
16  *
17  * You should have received a copy of the GNU Affero General Public License
18  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19  *
20  */
21
22 namespace Friendica\Federation\Factory;
23
24 use Friendica\Capabilities\ICanCreateFromTableRow;
25 use Friendica\Database\DBA;
26 use Friendica\Federation\Entity;
27 use GuzzleHttp\Psr7\Uri;
28
29 class GServer extends \Friendica\BaseFactory implements ICanCreateFromTableRow
30 {
31         /**
32          * @inheritDoc
33          */
34         public function createFromTableRow(array $row): Entity\GServer
35         {
36                 return new Entity\GServer(
37                         new Uri($row['url']),
38                         new Uri($row['nurl']),
39                         $row['version'],
40                         $row['site_name'],
41                         $row['info'] ?? '',
42                         $row['register_policy'],
43                         $row['registered-users'],
44                         $row['poco'] ? new Uri($row['poco']) : null,
45                         $row['noscrape'] ? new Uri($row['noscrape']) : null,
46                         $row['network'],
47                         $row['platform'],
48                         $row['relay-subscribe'],
49                         $row['relay-scope'],
50                         new \DateTimeImmutable($row['created']),
51                         $row['last_poco_query'] !== DBA::NULL_DATETIME ? new \DateTimeImmutable($row['last_poco_query']) : null,
52                         $row['last_contact'] !== DBA::NULL_DATETIME ? new \DateTimeImmutable($row['last_contact']) : null,
53                         $row['last_failure'] !== DBA::NULL_DATETIME ? new \DateTimeImmutable($row['last_failure']) : null,
54                         $row['directory-type'],
55                         $row['detection-method'],
56                         $row['failed'],
57                         $row['next_contact'] !== DBA::NULL_DATETIME ? new \DateTimeImmutable($row['next_contact']) : null,
58                         $row['protocol'],
59                         $row['active-week-users'],
60                         $row['active-month-users'],
61                         $row['active-halfyear-users'],
62                         $row['local-posts'],
63                         $row['local-comments'],
64                         $row['blocked'],
65                         $row['id'],
66                 );
67         }
68 }