id = $id; $this->exitCallback = $exitCallback; $this->implicitExitCallback = $implicitExitCallback; } /** * If the section has not already been exited, exit it and call the * destruct callback. * * @throws TimeoutException */ public function __destruct() { if ( !$this->hasExited ) { $this->exit(); if ( $this->implicitExitCallback ) { ( $this->implicitExitCallback )( $this->id ); } } } /** * Exit the critical section * * @throws TimeoutException */ public function exit() { if ( !$this->hasExited ) { $this->hasExited = true; ( $this->exitCallback )( $this->id ); } } /** * Get an integer uniquely identifying the section (within the scope of the * parent RequestTimeout object). * * @since 1.1.0 * @return int */ public function getId() { return $this->id; } }