-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCookie.php
50 lines (45 loc) · 1.09 KB
/
Cookie.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php declare(strict_types = 1);
namespace noxkiwi\core;
use noxkiwi\core\Interfaces\CookieInterface;
use noxkiwi\singleton\Singleton;
use function hash;
use function time;
use function uniqid;
/**
* I am the basic cookie class
*
* @package noxkiwi\core
* @author Jan Nox <[email protected]>
* @license https://nox.kiwi/license
* @copyright 2016 - 2021 noxkiwi
* @version 1.0.2
* @link https://nox.kiwi/
*/
abstract class Cookie extends Singleton implements CookieInterface
{
protected const USE_DRIVER = true;
/**
* I will create a Session ID for the Session
* @return string
*/
final protected function makeSessionid(): string
{
return hash('sha512', uniqid((string)time()) . time());
}
/**
* I will return the expiration of the Cookie.
* @return int
*/
final protected function getExpires(): int
{
return time() + 3600;
}
/**
* I will return the Cookie's domain.
* @return string
*/
final protected function getDomain(): string
{
return '/';
}
}