Lines n/a 0 / 0
Functions and Methods n/a 0 / 0
Classes and Traits n/a 0 / 0
Name Lines Functions and Methods CRAP Classes and Traits
1<?php
2
3declare(strict_types=1);
4
5namespace Tomaj\Hermes\Shutdown;
6
7use DateTimeInterface;
8
9interface ShutdownInterface
10{
11    /**
12     * Basic shutdown function.
13     *
14     * You have to return true or false if hermes worker should shutdown.
15     * This method is called from Dispatcher always after messages were processed.
16     *
17     * @param DateTimeInterface $startTime When the worker started. Dispatcher passes a DateTimeImmutable;
18     *                                     do not rely on being able to modify it.
19     */
20    public function shouldShutdown(DateTimeInterface $startTime): bool;
21
22    /**
23     * Initiate shutdown.
24     *
25     * This function performs necessary operations required to shutdown Hermes through used implementation.
26     *
27     * @param DateTimeInterface|null $shutdownTime (Optional) When Hermes should shut down. If null, current datetime should be used.
28     */
29    public function shutdown(?DateTimeInterface $shutdownTime = null): bool;
30}