| 
									
										
										
										
											2021-10-04 17:00:58 +01:00
										 |  |  | <?php | 
					
						
							| 
									
										
										
										
											2021-10-10 09:26:18 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | declare(strict_types = 1); | 
					
						
							| 
									
										
										
										
											2021-10-04 17:00:58 +01:00
										 |  |  | // {{{ License
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // This file is part of GNU social - https://www.gnu.org/software/social
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // GNU social is free software: you can redistribute it and/or modify
 | 
					
						
							|  |  |  | // it under the terms of the GNU Affero General Public License as published by
 | 
					
						
							|  |  |  | // the Free Software Foundation, either version 3 of the License, or
 | 
					
						
							|  |  |  | // (at your option) any later version.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // GNU social is distributed in the hope that it will be useful,
 | 
					
						
							|  |  |  | // but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
					
						
							|  |  |  | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
					
						
							|  |  |  | // GNU Affero General Public License for more details.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // You should have received a copy of the GNU Affero General Public License
 | 
					
						
							|  |  |  | // along with GNU social.  If not, see <http://www.gnu.org/licenses/>.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // }}}
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * ActivityPub implementation for GNU social | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @package   GNUsocial | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @author    Diogo Peralta Cordeiro <mail@diogo.site | 
					
						
							|  |  |  |  * @copyright 2021 Free Software Foundation, Inc http://www.fsf.org | 
					
						
							|  |  |  |  * @license   https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Plugin\ActivityPub\Entity; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | use App\Core\Entity; | 
					
						
							|  |  |  | use DateTimeInterface; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Table Definition for activitypub_actor | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @author    Diogo Peralta Cordeiro <mail@diogo.site | 
					
						
							|  |  |  |  * @copyright 2021 Free Software Foundation, Inc http://www.fsf.org | 
					
						
							|  |  |  |  * @license   https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | class ActivitypubActor extends Entity | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     // {{{ Autocode
 | 
					
						
							|  |  |  |     // @codeCoverageIgnoreStart
 | 
					
						
							|  |  |  |     private string $uri; | 
					
						
							|  |  |  |     private int $actor_id; | 
					
						
							|  |  |  |     private string $inbox_uri; | 
					
						
							|  |  |  |     private ?string $inbox_shared_uri = null; | 
					
						
							| 
									
										
										
										
											2021-10-10 09:26:18 +01:00
										 |  |  |     private DateTimeInterface $created; | 
					
						
							|  |  |  |     private DateTimeInterface $modified; | 
					
						
							| 
									
										
										
										
											2021-10-04 17:00:58 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     public function getUri(): string | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return $this->uri; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-19 13:48:50 +01:00
										 |  |  |     public function setUri(string $uri): self | 
					
						
							| 
									
										
										
										
											2021-10-04 17:00:58 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         $this->uri = $uri; | 
					
						
							| 
									
										
										
										
											2021-10-19 13:48:50 +01:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2021-10-04 17:00:58 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function getActorId(): int | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return $this->actor_id; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-19 13:48:50 +01:00
										 |  |  |     public function setActorId(int $actor_id): self | 
					
						
							| 
									
										
										
										
											2021-10-04 17:00:58 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         $this->actor_id = $actor_id; | 
					
						
							| 
									
										
										
										
											2021-10-19 13:48:50 +01:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2021-10-04 17:00:58 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function getInboxUri(): string | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return $this->inbox_uri; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-19 13:48:50 +01:00
										 |  |  |     public function setInboxUri(string $inbox_uri): self | 
					
						
							| 
									
										
										
										
											2021-10-04 17:00:58 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         $this->inbox_uri = $inbox_uri; | 
					
						
							| 
									
										
										
										
											2021-10-19 13:48:50 +01:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2021-10-04 17:00:58 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function getInboxSharedUri(): string | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return $this->inbox_shared_uri; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-19 13:48:50 +01:00
										 |  |  |     public function setInboxSharedUri(string $inbox_shared_uri): self | 
					
						
							| 
									
										
										
										
											2021-10-04 17:00:58 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         $this->inbox_shared_uri = $inbox_shared_uri; | 
					
						
							| 
									
										
										
										
											2021-10-19 13:48:50 +01:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2021-10-04 17:00:58 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function getCreated(): DateTimeInterface | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return $this->created; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-19 13:48:50 +01:00
										 |  |  |     public function setCreated(DateTimeInterface $created): self | 
					
						
							| 
									
										
										
										
											2021-10-04 17:00:58 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         $this->created = $created; | 
					
						
							| 
									
										
										
										
											2021-10-19 13:48:50 +01:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2021-10-04 17:00:58 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function getModified(): DateTimeInterface | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return $this->modified; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-19 13:48:50 +01:00
										 |  |  |     public function setModified(DateTimeInterface $modified): self | 
					
						
							| 
									
										
										
										
											2021-10-04 17:00:58 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         $this->modified = $modified; | 
					
						
							| 
									
										
										
										
											2021-10-19 13:48:50 +01:00
										 |  |  |         return $this; | 
					
						
							| 
									
										
										
										
											2021-10-04 17:00:58 +01:00
										 |  |  |     } | 
					
						
							|  |  |  |     // @codeCoverageIgnoreEnd
 | 
					
						
							|  |  |  |     // }}} Autocode
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-19 13:48:50 +01:00
										 |  |  |     public static function schemaDef(): array | 
					
						
							| 
									
										
										
										
											2021-10-04 17:00:58 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         return [ | 
					
						
							|  |  |  |             'name'   => 'activitypub_actor', | 
					
						
							|  |  |  |             'fields' => [ | 
					
						
							|  |  |  |                 'uri'              => ['type' => 'text', 'not null' => true], | 
					
						
							|  |  |  |                 'actor_id'         => ['type' => 'int', 'not null' => true], | 
					
						
							|  |  |  |                 'inbox_uri'        => ['type' => 'text', 'not null' => true], | 
					
						
							|  |  |  |                 'inbox_shared_uri' => ['type' => 'text'], | 
					
						
							|  |  |  |                 'created'          => ['type' => 'datetime',  'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'], | 
					
						
							|  |  |  |                 'modified'         => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'], | 
					
						
							|  |  |  |             ], | 
					
						
							|  |  |  |             'primary key'  => ['actor_id'], | 
					
						
							|  |  |  |             'foreign keys' => [ | 
					
						
							|  |  |  |                 'activitypub_actor_actor_id_fkey' => ['actor', ['actor_id' => 'id']], | 
					
						
							|  |  |  |             ], | 
					
						
							|  |  |  |         ]; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |