PHP Class PHPDaemon\Core\Timer

Author: Vasily Zorin ([email protected])
Inheritance: use trait PHPDaemon\Traits\ClassWatchdog, use trait PHPDaemon\Traits\StaticObjectWatchdog, use trait PHPDaemon\Traits\EventLoopContainer
Afficher le fichier Open project: kakserpom/phpdaemon Class Usage Examples

Méthodes publiques

Свойство Type Description
$cb Callback
$finished Is the timer finished?
$id Timer id
$lastTimeout Current timeout holder
$priority Priority

Protected Properties

Свойство Type Description
$counter Counter
$ev Event resource
$list List of timers

Méthodes publiques

Méthode Description
__construct ( callable $cb, integer $timeout = null, integer | string $id = null, integer $priority = null ) Constructor
__destruct ( ) : void Destructor
add ( callable $cb, integer $timeout = null, integer | string $id = null, integer $priority = null ) : integer | string Adds timer
cancel ( ) : void Cancels timer
cancelTimeout ( integer | string $id ) : void Cancels timer by ID
eventCall ( ) : void Called when timer is triggered
finish ( ) : void Finishes timer
free ( ) : void Frees the timer
remove ( integer | string $id ) : void Removes timer by ID
setPriority ( integer $priority ) : void Set prioriry
setTimeout ( integer | string $id, integer $timeout = null ) : boolean Sets timeout
timeout ( integer $timeout = null ) : void Sets timeout

Method Details

__construct() public méthode

Constructor
public __construct ( callable $cb, integer $timeout = null, integer | string $id = null, integer $priority = null )
$cb callable Callback
$timeout integer Timeout
$id integer | string Timer ID
$priority integer Priority

__destruct() public méthode

Destructor
public __destruct ( ) : void
Résultat void

add() public static méthode

Adds timer
public static add ( callable $cb, integer $timeout = null, integer | string $id = null, integer $priority = null ) : integer | string
$cb callable Callback
$timeout integer Timeout
$id integer | string Timer ID
$priority integer Priority
Résultat integer | string Timer ID

cancel() public méthode

Cancels timer
public cancel ( ) : void
Résultat void

cancelTimeout() public static méthode

Cancels timer by ID
public static cancelTimeout ( integer | string $id ) : void
$id integer | string Timer ID
Résultat void

eventCall() public méthode

Called when timer is triggered
public eventCall ( ) : void
Résultat void

finish() public méthode

Finishes timer
public finish ( ) : void
Résultat void

free() public méthode

Frees the timer
public free ( ) : void
Résultat void

remove() public static méthode

Removes timer by ID
public static remove ( integer | string $id ) : void
$id integer | string Timer ID
Résultat void

setPriority() public méthode

Set prioriry
public setPriority ( integer $priority ) : void
$priority integer Priority
Résultat void

setTimeout() public static méthode

Sets timeout
public static setTimeout ( integer | string $id, integer $timeout = null ) : boolean
$id integer | string Timer ID
$timeout integer Timeout
Résultat boolean

timeout() public méthode

Sets timeout
public timeout ( integer $timeout = null ) : void
$timeout integer Timeout
Résultat void

Property Details

$cb public_oe property

Callback
public $cb

$counter protected_oe static_oe property

Counter
protected static $counter

$ev protected_oe property

Event resource
protected $ev

$finished public_oe property

Is the timer finished?
public $finished

$id public_oe property

Timer id
public $id

$lastTimeout public_oe property

Current timeout holder
public $lastTimeout

$list protected_oe static_oe property

List of timers
protected static $list

$priority public_oe property

Priority
public $priority