Debian Codegraph @

vendor/wikimedia/request-timeout/src/Detail/ExcimerRequestTimeout.php

raw
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 }