PHP 클래스 malkusch\lock\util\Loop

저자: Markus Malkusch ([email protected])
파일 보기 프로젝트 열기: malkusch/lock 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( integer $timeout = 3 ) Sets the timeout.
end ( ) Notifies that this was the last iteration.
execute ( callable $code ) : mixed Repeats executing a code until it was succesful.

메소드 상세

__construct() 공개 메소드

The default is 3 seconds.
public __construct ( integer $timeout = 3 )
$timeout integer The timeout in seconds.

end() 공개 메소드

Notifies that this was the last iteration.
public end ( )

execute() 공개 메소드

The code has to be designed in a way that it can be repeated without any side effects. When execution was successful it should notify that event by calling {@link Loop::end()}. I.e. the only side effects of the code may happen after a successful execution. If the code throws an exception it will stop repeating the execution.
public execute ( callable $code ) : mixed
$code callable The executed code block.
리턴 mixed The return value of the executed block.