1
0
mirror of https://github.com/danog/amp.git synced 2024-12-03 18:07:57 +01:00

Put $delay and $interval at the first places of their respective methods

Closes #54
This commit is contained in:
Bob Weinand 2016-05-22 18:07:21 +02:00
parent 4dce408678
commit d0701c20d3
2 changed files with 10 additions and 10 deletions

View File

@ -127,29 +127,29 @@ final class Loop
/**
* Delay the execution of a callback. The time delay is approximate and accuracy is not guaranteed.
*
* @param callable(string $watcherId, mixed $data) $callback The callback to delay.
* @param int $time The amount of time, in milliseconds, to delay the execution for.
* @param callable(string $watcherId, mixed $data) $callback The callback to delay.
* @param mixed $data Arbitrary data given to the callback function as the $data parameter.
*
* @return string An identifier that can be used to cancel, enable or disable the watcher.
*/
public static function delay(callable $callback, $time, $data = null)
public static function delay($time, callable $callback, $data = null)
{
return self::get()->delay($callback, $time, $data);
return self::get()->delay($time, $callback, $data);
}
/**
* Repeatedly execute a callback. The interval between executions is approximate and accuracy is not guaranteed.
*
* @param callable(string $watcherId, mixed $data) $callback The callback to repeat.
* @param int $interval The time interval, in milliseconds, to wait between executions.
* @param callable(string $watcherId, mixed $data) $callback The callback to repeat.
* @param mixed $data Arbitrary data given to the callback function as the $data parameter.
*
* @return string An identifier that can be used to cancel, enable or disable the watcher.
*/
public static function repeat(callable $callback, $interval, $data = null)
public static function repeat($interval, callable $callback, $data = null)
{
return self::get()->repeat($callback, $interval, $data);
return self::get()->repeat($interval, $callback, $data);
}
/**

View File

@ -31,24 +31,24 @@ interface LoopDriver
/**
* Delay the execution of a callback. The time delay is approximate and accuracy is not guaranteed.
*
* @param callable(string $watcherId, mixed $data) $callback The callback to delay.
* @param int $delay The amount of time, in milliseconds, to delay the execution for.
* @param callable(string $watcherId, mixed $data) $callback The callback to delay.
* @param mixed $data Arbitrary data given to the callback function as the $data parameter.
*
* @return string An identifier that can be used to cancel, enable or disable the watcher.
*/
public function delay(callable $callback, $delay, $data = null);
public function delay($delay, callable $callback, $data = null);
/**
* Repeatedly execute a callback. The interval between executions is approximate and accuracy is not guaranteed.
*
* @param callable(string $watcherId, mixed $data) $callback The callback to repeat.
* @param int $interval The time interval, in milliseconds, to wait between executions.
* @param callable(string $watcherId, mixed $data) $callback The callback to repeat.
* @param mixed $data Arbitrary data given to the callback function as the $data parameter.
*
* @return string An identifier that can be used to cancel, enable or disable the watcher.
*/
public function repeat(callable $callback, $interval, $data = null);
public function repeat($interval, callable $callback, $data = null);
/**
* Execute a callback when a stream resource becomes readable.