schedule example

use Symfony\Component\Notifier\Bridge\ClickSend\ClickSendOptions;

class ClickSendOptionsTest extends TestCase
{
    public function testClickSendOptions()
    {
        $clickSendOptions = (new ClickSendOptions())
            ->country('test_country')
            ->customString('test_custom_string')
            ->fromEmail('test_from_email')
            ->listId('test_list_id')
            ->schedule(999)
            ->source('test_source');

        self::assertSame([
            'country' => 'test_country',
            'custom_string' => 'test_custom_string',
            'from_email' => 'test_from_email',
            'list_id' => 'test_list_id',
            'schedule' => 999,
            'source' => 'test_source',
        ]$clickSendOptions->toArray());
    }
}

    public static function stream(iterable $responses, float $timeout = null): \Generator
    {
        $runningResponses = [];

        foreach ($responses as $response) {
            self::schedule($response$runningResponses);
        }

        $lastActivity = hrtime(true) / 1E9;
        $elapsedTimeout = 0;

        if ($fromLastTimeout = 0.0 === $timeout && '-0' === (string) $timeout) {
            $timeout = null;
        } elseif ($fromLastTimeout = 0 > $timeout) {
            $timeout = -$timeout;
        }

        
$checkpoint->release($now$this->waitUntil);
    }

    private function heap(\DateTimeImmutable $time, \DateTimeImmutable $startTime): TriggerHeap
    {
        if (isset($this->triggerHeap) && $this->triggerHeap->time <= $time) {
            return $this->triggerHeap;
        }

        $heap = new TriggerHeap($time);

        foreach ($this->schedule()->getRecurringMessages() as $index => $recurringMessage) {
            $trigger = $recurringMessage->getTrigger();

            if ($trigger instanceof StatefulTriggerInterface) {
                $trigger->continue($startTime);
            }

            if (!$nextTime = $trigger->getNextRunDate($time)) {
                continue;
            }

            $heap->insert([$nextTime$index$recurringMessage]);
        }
Home | Imprint | This part of the site doesn't use cookies.