Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
timer.php
1
<?php
2
3
namespace
Bitrix\Translate\Controller
;
4
5
use
Bitrix\Translate
;
6
10
class
Timer
implements
Translate\Controller\ITimeLimit
11
{
13
private
$timeLimit = 15;
14
16
private
$startTime = -1;
17
21
public
function
__construct
($timeLimit = -1)
22
{
23
if
($timeLimit > 0)
24
{
25
$this->
setTimeLimit
($timeLimit);
26
}
27
}
28
36
public
function
startTimer
($startingTime =
null
)
37
{
38
if
((
int
)$startingTime > 0)
39
{
40
$this->startTime = (int)$startingTime;
41
}
42
else
43
{
44
$this->startTime = \time();
45
}
46
47
return
$this;
48
}
49
55
public
function
hasTimeLimitReached
()
56
{
57
if
($this->timeLimit > 0 && $this->startTime > 0)
58
{
59
if
((\time() - $this->startTime) >= $this->timeLimit)
60
{
61
return
true
;
62
}
63
}
64
65
return
false
;
66
}
67
72
public
function
getTimeLimit
()
73
{
74
return
$this->timeLimit;
75
}
76
84
public
function
setTimeLimit
($timeLimit)
85
{
86
$this->timeLimit = $timeLimit;
87
88
return
$this;
89
}
90
}
91
Bitrix\Translate\Controller\Timer
Definition
timer.php:11
Bitrix\Translate\Controller\Timer\startTimer
startTimer($startingTime=null)
Definition
timer.php:36
Bitrix\Translate\Controller\Timer\getTimeLimit
getTimeLimit()
Definition
timer.php:72
Bitrix\Translate\Controller\Timer\__construct
__construct($timeLimit=-1)
Definition
timer.php:21
Bitrix\Translate\Controller\Timer\hasTimeLimitReached
hasTimeLimitReached()
Definition
timer.php:55
Bitrix\Translate\Controller\Timer\setTimeLimit
setTimeLimit($timeLimit)
Definition
timer.php:84
Bitrix\Translate\Controller\ITimeLimit
Definition
itimelimit.php:7
Bitrix\Translate\Controller
Definition
action.php:2
Bitrix\Translate
modules
translate
lib
controller
timer.php
Создано системой
1.10.0