spl_object_hash
reactphp/event-loop
Supported Versions: PHP 5 >= 5.2.0, PHP 7, PHP 8
Return hash id for given object
spl_object_hash
(
object $object
):
string
public function
add
(
TimerInterface $timer
)
{
$id
=
\spl_object_hash
(
$timer
);
$this
->
timers
[
$id
] =
$timer
;
$this
->
schedule
[
$id
] =
$timer
->
getInterval
() +
$this
->
updateTime
();
$this
->
sorted
=
false
;
src/Timer/Timers.php
public function
contains
(
TimerInterface $timer
)
{
return isset(
$this
->
timers
[
\spl_object_hash
(
$timer
)]);
}
public function
cancel
(
TimerInterface $timer
)
src/Timer/Timers.php
public function
cancel
(
TimerInterface $timer
)
{
$id
=
\spl_object_hash
(
$timer
);
unset(
$this
->
timers
[
$id
],
$this
->
schedule
[
$id
]);
}
src/Timer/Timers.php