]> git.mxchange.org Git - friendica.git/blob - src/Security/TwoFactor/Model/TrustedBrowser.php
Merge remote-tracking branch 'upstream/develop' into more-q
[friendica.git] / src / Security / TwoFactor / Model / TrustedBrowser.php
1 <?php
2
3 namespace Friendica\Security\TwoFactor\Model;
4
5 use Friendica\BaseEntity;
6 use Friendica\Util\DateTimeFormat;
7
8 /**
9  * Class TrustedBrowser
10  *
11  *
12  * @property-read $cookie_hash
13  * @property-read $uid
14  * @property-read $user_agent
15  * @property-read $created
16  * @property-read $last_used
17  * @package Friendica\Model\TwoFactor
18  */
19 class TrustedBrowser extends BaseEntity
20 {
21         protected $cookie_hash;
22         protected $uid;
23         protected $user_agent;
24         protected $created;
25         protected $last_used;
26
27         /**
28          * Please do not use this constructor directly, instead use one of the method of the TrustedBroser factory.
29          *
30          * @see \Friendica\Security\TwoFactor\Factory\TrustedBrowser
31          *
32          * @param string      $cookie_hash
33          * @param int         $uid
34          * @param string      $user_agent
35          * @param string      $created
36          * @param string|null $last_used
37          */
38         public function __construct(string $cookie_hash, int $uid, string $user_agent, string $created, string $last_used = null)
39         {
40                 $this->cookie_hash = $cookie_hash;
41                 $this->uid = $uid;
42                 $this->user_agent = $user_agent;
43                 $this->created = $created;
44                 $this->last_used = $last_used;
45         }
46
47         public function recordUse()
48         {
49                 $this->last_used = DateTimeFormat::utcNow();
50         }
51 }