Fixed timer implementation
This commit is contained in:
@ -137,6 +137,7 @@ class Shell
|
||||
private $userdata;
|
||||
public function __construct($interval, callable $handler, array $userdata) {
|
||||
$this->interval = $interval / 1000;
|
||||
$this->next = microtime(true) + $this->interval;
|
||||
$this->handler = $handler;
|
||||
$this->userdata = $userdata;
|
||||
}
|
||||
@ -157,9 +158,11 @@ class Shell
|
||||
*
|
||||
* @param Timer $timer
|
||||
*/
|
||||
public function removeTimer(Timer $timer)
|
||||
public function removeTimer($timer)
|
||||
{
|
||||
|
||||
$this->timers = array_filter($this->timers, function ($v) use ($timer) {
|
||||
return ($v !== $timer);
|
||||
});
|
||||
}
|
||||
|
||||
public function setPrompt($text)
|
||||
|
Reference in New Issue
Block a user