3 * @copyright Copyright (C) 2010-2023, the Friendica project
5 * @license GNU AGPL version 3 or any later version
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.
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.
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/>.
22 namespace Friendica\Contact\LocalRelationship\Entity;
24 use Friendica\Core\Protocol;
25 use Friendica\Model\Contact;
28 * @property-read int $userId
29 * @property-read int $contactId
30 * @property-read int $uriId
31 * @property-read bool $blocked
32 * @property-read bool $ignored
33 * @property-read bool $collapsed
34 * @property-read bool $hidden
35 * @property-read bool $pending
36 * @property-read int $rel
37 * @property-read string $info
38 * @property-read bool $notifyNewPosts
39 * @property-read bool $isRemoteSelf
40 * @property-read int $fetchFurtherInformation
41 * @property-read string $ffiKeywordDenylist
42 * @property-read bool $subhub
43 * @property-read string $hubVerify
44 * @property-read string $protocol
45 * @property-read int $rating
46 * @property-read int $priority
48 class LocalRelationship extends \Friendica\BaseEntity
69 protected $notifyNewPosts;
71 protected $isRemoteSelf;
73 protected $fetchFurtherInformation;
75 protected $ffiKeywordDenylist;
87 public function __construct(int $userId, int $contactId, bool $blocked = false, bool $ignored = false, bool $collapsed = false, bool $hidden = false, bool $pending = false, int $rel = Contact::NOTHING, string $info = '', bool $notifyNewPosts = false, bool $isRemoteSelf = false, int $fetchFurtherInformation = 0, string $ffiKeywordDenylist = '', bool $subhub = false, string $hubVerify = '', string $protocol = Protocol::PHANTOM, ?int $rating = null, ?int $priority = null)
89 $this->userId = $userId;
90 $this->contactId = $contactId;
91 $this->blocked = $blocked;
92 $this->ignored = $ignored;
93 $this->collapsed = $collapsed;
94 $this->hidden = $hidden;
95 $this->pending = $pending;
98 $this->notifyNewPosts = $notifyNewPosts;
99 $this->isRemoteSelf = $isRemoteSelf;
100 $this->fetchFurtherInformation = $fetchFurtherInformation;
101 $this->ffiKeywordDenylist = $ffiKeywordDenylist;
102 $this->subhub = $subhub;
103 $this->hubVerify = $hubVerify;
104 $this->protocol = $protocol;
105 $this->rating = $rating;
106 $this->priority = $priority;
109 public function addFollow()
111 $this->rel = in_array($this->rel, [Contact::FOLLOWER, Contact::FRIEND]) ? Contact::FRIEND : Contact::SHARING;
114 public function removeFollow()
116 $this->rel = in_array($this->rel, [Contact::FOLLOWER, Contact::FRIEND]) ? Contact::FOLLOWER : Contact::NOTHING;
119 public function addFollower()
121 $this->rel = in_array($this->rel, [Contact::SHARING, Contact::FRIEND]) ? Contact::FRIEND : Contact::FOLLOWER;
124 public function removeFollower()
126 $this->rel = in_array($this->rel, [Contact::SHARING, Contact::FRIEND]) ? Contact::SHARING : Contact::NOTHING;