Rename generic loop

This commit is contained in:
Daniil Gentili 2019-06-02 13:27:16 +02:00
parent 751aedf92b
commit e6375a4701
4 changed files with 13 additions and 7 deletions

View File

@ -205,6 +205,9 @@ class APIFactory extends AsyncConstruct
return $this->API->settings;
}
if ($name === 'logger') {
return $this->API->logger;
}
return $this->API->storage[$name];
}

View File

@ -1,6 +1,6 @@
<?php
/**
* Generic period fetcher loop
* Generic loop
*
* This file is part of MadelineProto.
* MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
@ -18,15 +18,14 @@
namespace danog\MadelineProto\Loop\Generic;
use danog\MadelineProto\Logger;
use danog\MadelineProto\Loop\Impl\ResumableSignalLoop;
/**
* Update loop.
* Generic loop.
*
* @author Daniil Gentili <daniil@daniil.it>
*/
class PeriodicFetcherLoop extends ResumableSignalLoop
class GenericLoop extends ResumableSignalLoop
{
const STOP = -1;
const PAUSE = null;
@ -45,7 +44,7 @@ class PeriodicFetcherLoop extends ResumableSignalLoop
public function __construct($API, $callback, $name)
{
$this->API = $API;
$this->callback = $callback;
$this->callback = $callback->bindTo($this);
$this->name = $name;
}
public function loop()

View File

@ -39,6 +39,10 @@ interface LoopInterface
*/
public function loop();
/**
* Get name of the loop
*
* @return string
*/
public function __toString(): string;
}

View File

@ -30,7 +30,7 @@ interface ResumableLoopInterface extends LoopInterface
/**
* Pause the loop.
*
* @param int $time For how long to pause the loop
* @param int $time For how long to pause the loop, if null will pause forever (until resume is called from outside of the loop)
*
* @return Promise
*/