Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
8 / 8 |
|
100.00% |
7 / 7 |
CRAP | |
100.00% |
1 / 1 |
ExcimerRequestTimeout | |
100.00% |
8 / 8 |
|
100.00% |
7 / 7 |
7 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
__destruct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
enterCriticalSection | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
exitCriticalSection | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setWallTimeLimit | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getWallTimeRemaining | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getWallTimeLimit | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace Wikimedia\RequestTimeout\Detail; |
4 | |
5 | use Wikimedia\RequestTimeout\RequestTimeout; |
6 | |
7 | /** |
8 | * Excimer implementation of request timeouts. |
9 | * |
10 | * See the doc comment on ExcimerTimerWrapper for an explanation of the split. |
11 | */ |
12 | class ExcimerRequestTimeout extends RequestTimeout { |
13 | /** @var ExcimerTimerWrapper */ |
14 | private $timerWrapper; |
15 | |
16 | public function __construct() { |
17 | $this->timerWrapper = new ExcimerTimerWrapper; |
18 | } |
19 | |
20 | /** |
21 | * ExcimerTimerWrapper has a circular reference in it and so the timer must |
22 | * be explicitly destroyed. |
23 | */ |
24 | public function __destruct() { |
25 | $this->timerWrapper->stop(); |
26 | } |
27 | |
28 | public function enterCriticalSection( $name, $emergencyLimit, $emergencyCallback ) { |
29 | return $this->timerWrapper->enterCriticalSection( |
30 | $name, $emergencyLimit, $emergencyCallback ); |
31 | } |
32 | |
33 | public function exitCriticalSection( $id ) { |
34 | $this->timerWrapper->exitCriticalSection( $id ); |
35 | } |
36 | |
37 | public function setWallTimeLimit( $limit ) { |
38 | $this->timerWrapper->setWallTimeLimit( $limit ); |
39 | } |
40 | |
41 | public function getWallTimeRemaining() { |
42 | return $this->timerWrapper->getWallTimeRemaining(); |
43 | } |
44 | |
45 | public function getWallTimeLimit() { |
46 | return $this->timerWrapper->getWallTimeLimit(); |
47 | } |
48 | } |