]> git.mxchange.org Git - friendica.git/blob - src/Navigation/Notifications/Entity/Notification.php
Refactoring Core class structures ...
[friendica.git] / src / Navigation / Notifications / Entity / Notification.php
1 <?php
2
3 namespace Friendica\Navigation\Notifications\Entity;
4
5 use DateTime;
6 use Friendica\BaseEntity;
7
8 /**
9  * @property-read $id
10  * @property-read $uid
11  * @property-read $verb
12  * @property-read $type
13  * @property-read $actorId
14  * @property-read $targetUriId
15  * @property-read $parentUriId
16  * @property-read $created
17  * @property-read $seen
18  */
19 class Notification extends BaseEntity
20 {
21         /** @var int */
22         protected $id;
23         /** @var int */
24         protected $uid;
25         /** @var string */
26         protected $verb;
27         /**
28          * @var int One of the \Friendica\Model\Post\UserNotification::TYPE_* constant values
29          * @see \Friendica\Model\Post\UserNotification
30          */
31         protected $type;
32         /** @var int */
33         protected $actorId;
34         /** @var int */
35         protected $targetUriId;
36         /** @var int */
37         protected $parentUriId;
38         /** @var DateTime */
39         protected $created;
40         /** @var bool */
41         protected $seen;
42
43         /**
44          * Please do not use this constructor directly, instead use one of the method of the Notification factory.
45          *
46          * @param int           $uid
47          * @param string        $verb
48          * @param int           $type
49          * @param int           $actorId
50          * @param int|null      $targetUriId
51          * @param int|null      $parentUriId
52          * @param DateTime|null $created
53          * @param bool          $seen
54          * @param int|null      $id
55          * @see \Friendica\Navigation\Notifications\Factory\Notification
56          */
57         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)
58         {
59                 $this->uid         = $uid;
60                 $this->verb        = $verb;
61                 $this->type        = $type;
62                 $this->actorId     = $actorId;
63                 $this->targetUriId = $targetUriId;
64                 $this->parentUriId = $parentUriId ?: $targetUriId;
65                 $this->created     = $created;
66                 $this->seen        = $seen;
67                 $this->id          = $id;
68         }
69
70         public function setSeen()
71         {
72                 $this->seen = true;
73         }
74 }