]> git.mxchange.org Git - friendica.git/blob - tests/Util/StaticCookie.php
Merge pull request #7995 from annando/probe-hubzilla
[friendica.git] / tests / Util / StaticCookie.php
1 <?php
2
3 namespace Friendica\Test\Util;
4
5 use Friendica\Model\User\Cookie;
6
7 /**
8  * Overrides the Cookie class so all cookie information will be saved to a static public variable
9  */
10 class StaticCookie extends Cookie
11 {
12         /** @var array static Cookie array mock */
13         public static $_COOKIE = [];
14         /** @var int The last expire time set */
15         public static $_EXPIRE;
16
17         protected function setCookie(string $name, string $value = null, int $expire = null, bool $secure = null)
18         {
19                 self::$_COOKIE[$name] = $value;
20                 self::$_EXPIRE = $expire;
21         }
22
23         public static function clearStatic()
24         {
25                 self::$_EXPIRE = null;
26                 self::$_COOKIE = [];
27         }
28 }