Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
session.php
1<?php
2namespace Bitrix\Rest\Event;
3
12{
13 const PARAM_SESSION = 'EVENT_SESSION';
14
15 private static $TTL = null;
16
17 private static $ttlDecreased = false;
18 private static $set = false;
19
20 public static function get()
21 {
22 if(!self::$set)
23 {
24 self::$TTL = \CRestUtil::HANDLER_SESSION_TTL;
25 self::$ttlDecreased = true;
26 }
27 else
28 {
29 if(!self::$ttlDecreased)
30 {
31 self::$TTL--;
32 self::$ttlDecreased = true;
33 }
34 }
35
36 return self::$TTL <= 0 ? false : self::$TTL;
37 }
38
39 public static function set($session)
40 {
41 self::$TTL = is_array($session) ? $session['TTL'] : $session;
42
43 self::$ttlDecreased = false;
44 self::$set = true;
45 }
46}