]> git.mxchange.org Git - friendica.git/blob - src/Navigation/Notifications/Entity/Notification.php
Fix wrong spelling
[friendica.git] / src / Navigation / Notifications / Entity / Notification.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2010-2022, 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\Navigation\Notifications\Entity;
23
24 use DateTime;
25 use Friendica\BaseEntity;
26
27 /**
28  * @property-read $id
29  * @property-read $uid
30  * @property-read $verb
31  * @property-read $type
32  * @property-read $actorId
33  * @property-read $targetUriId
34  * @property-read $parentUriId
35  * @property-read $created
36  * @property-read $seen
37  */
38 class Notification extends BaseEntity
39 {
40         /** @var int */
41         protected $id;
42         /** @var int */
43         protected $uid;
44         /** @var string */
45         protected $verb;
46         /**
47          * @var int One of the \Friendica\Model\Post\UserNotification::TYPE_* constant values
48          * @see \Friendica\Model\Post\UserNotification
49          */
50         protected $type;
51         /** @var int */
52         protected $actorId;
53         /** @var int */
54         protected $targetUriId;
55         /** @var int */
56         protected $parentUriId;
57         /** @var DateTime */
58         protected $created;
59         /** @var bool */
60         protected $seen;
61         /** @var bool */
62         protected $dismissed;
63
64         /**
65          * Please do not use this constructor directly, instead use one of the method of the Notification factory.
66          *
67          * @param int           $uid
68          * @param string        $verb
69          * @param int           $type
70          * @param int           $actorId
71          * @param int|null      $targetUriId
72          * @param int|null      $parentUriId
73          * @param DateTime|null $created
74          * @param bool          $seen
75          * @param int|null      $id
76          * @param bool          $dismissed
77          * @see \Friendica\Navigation\Notifications\Factory\Notification
78          */
79         public function __construct(int $uid, string $verb, int $type, int $actorId, int $targetUriId = null, int $parentUriId = null, DateTime $created = null, bool $seen = false, int $id = null, bool $dismissed = false)
80         {
81                 $this->uid         = $uid;
82                 $this->verb        = $verb;
83                 $this->type        = $type;
84                 $this->actorId     = $actorId;
85                 $this->targetUriId = $targetUriId;
86                 $this->parentUriId = $parentUriId ?: $targetUriId;
87                 $this->created     = $created;
88                 $this->seen        = $seen;
89                 $this->id          = $id;
90                 $this->dismissed   = $dismissed;
91         }
92
93         public function setSeen()
94         {
95                 $this->seen = true;
96         }
97
98         public function setDismissed()
99         {
100                 $this->dismissed = true;
101         }
102 }