1 | <?php |
||
24 | class SessionLifespan |
||
25 | { |
||
26 | |||
27 | /** |
||
28 | * how long an EE session lasts in seconds |
||
29 | * default session lifespan of 1 hour (for not so instant IPNs) |
||
30 | * |
||
31 | * @var int $lifespan |
||
32 | */ |
||
33 | private $lifespan; |
||
34 | |||
35 | |||
36 | /** |
||
37 | * SessionLifespan constructor. |
||
38 | * |
||
39 | * @param int $lifespan |
||
40 | * @throws DomainException |
||
41 | */ |
||
42 | public function __construct($lifespan = 0) |
||
48 | |||
49 | |||
50 | /** |
||
51 | * @param int $lifespan |
||
52 | * @throws DomainException |
||
53 | */ |
||
54 | protected function setLifespan($lifespan) |
||
74 | |||
75 | |||
76 | /** |
||
77 | * @return int |
||
78 | */ |
||
79 | public function inSeconds() |
||
83 | |||
84 | |||
85 | /** |
||
86 | * @param string $separator |
||
87 | * @return string |
||
88 | */ |
||
89 | public function inHoursMinutesSeconds($separator = ':') |
||
100 | |||
101 | |||
102 | /** |
||
103 | * Returns a timestamp for when the session would expire based on this lifespan |
||
104 | * |
||
105 | * @param bool $utc If true, displays expiration in UTC |
||
106 | * If false, displays expiration in local time |
||
107 | * @return float |
||
108 | */ |
||
109 | public function expiration($utc = true) |
||
113 | |||
114 | |||
115 | /** |
||
116 | * @return string |
||
117 | */ |
||
118 | public function __toString() |
||
122 | } |
||
123 |