priority example

class BandwidthOptionsTest extends TestCase
{
    public function testBandwidthOptions()
    {
        $bandwidthOptions = (new BandwidthOptions())
            ->media(['foo'])
            ->tag('test_tag')
            ->accountId('test_account_id')
            ->applicationId('test_application_id')
            ->expiration('test_expiration')
            ->priority('test_priority');

        self::assertSame([
            'media' => ['foo'],
            'tag' => 'test_tag',
            'accountId' => 'test_account_id',
            'applicationId' => 'test_application_id',
            'expiration' => 'test_expiration',
            'priority' => 'test_priority',
        ]$bandwidthOptions->toArray());
    }
}
$e = new Email();
        $e->bcc('lucas@symfony.com');
        $e->bcc($caramel);
        $this->assertSame([$caramel]$e->getBcc());
    }

    public function testPriority()
    {
        $e = new Email();
        $this->assertEquals(3, $e->getPriority());

        $e->priority(1);
        $this->assertEquals(1, $e->getPriority());
        $e->priority(10);
        $this->assertEquals(5, $e->getPriority());
        $e->priority(-10);
        $this->assertEquals(1, $e->getPriority());
    }

    public function testGenerateBodyThrowsWhenEmptyBody()
    {
        $this->expectException(\LogicException::class);
        (new Email())->getBody();
    }

    public function getBcc(): array
    {
        return $this->message->getBcc();
    }

    /** * @return $this */
    public function setPriority(int $priority)static
    {
        $this->message->priority($priority);

        return $this;
    }

    public function getPriority(): int
    {
        return $this->message->getPriority();
    }
}
public static function fromNotification(Notification $notification): self
    {
        $options = new self();
        $options->title($notification->getSubject());
        $priority = match ($notification->getImportance()) {
            Notification::IMPORTANCE_URGENT => 2,
            Notification::IMPORTANCE_HIGH => 1,
            Notification::IMPORTANCE_MEDIUM => 0,
            Notification::IMPORTANCE_LOW => -1
        };
        $options->priority($priority);

        return $options;
    }

    public function toArray(): array
    {
        $options = $this->options;
        unset($options['attachment']);

        return $options;
    }

    

        parent::markAsRendered();

        $this->rendered = true;
    }

    public function getPreparedHeaders(): Headers
    {
        $headers = parent::getPreparedHeaders();

        $importance = $this->context['importance'] ?? self::IMPORTANCE_LOW;
        $this->priority($this->determinePriority($importance));
        if ($this->context['importance']) {
            $headers->setHeaderBody('Text', 'Subject', sprintf('[%s] %s', strtoupper($importance)$this->getSubject()));
        }

        return $headers;
    }

    private function determinePriority(string $importance): int
    {
        return match ($importance) {
            self::IMPORTANCE_URGENT => self::PRIORITY_HIGHEST,
            
'senders' => ['workqueue'],
            ],
        ],
    ]);
    $config->messenger()
        ->routing('Foo\\Message')->senders(['workqueue']);
    $config->messenger()
        ->routing('Foo\\DoubleMessage')->senders(['sync', 'workqueue']);

    $config->messenger()->receiving()
        ->color('blue')
        ->priority(10);
    $config->messenger()->receiving()
        ->color('red')
        ->priority(5);
};
Home | Imprint | This part of the site doesn't use cookies.