Publisher/NullPublisher.php

synaplan · backend/src/Realtime/Publisher/NullPublisher.php · php · Apache-2.0
realtime

No-op implementation of RealtimePublisherInterface for tests and disabled realtime.

// Source: https://github.com/metadist/synaplan | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
<?php

declare(strict_types=1);

namespace App\Realtime\Publisher;

use App\Realtime\Channel\ChannelInterface;

/**
 * No-op publisher used in test environments and when realtime is disabled.
 *
 * Tests should bind this implementation explicitly via the test container so
 * a missing Centrifugo never makes assertions flaky.
 */
final class NullPublisher implements RealtimePublisherInterface
{
    public function publish(ChannelInterface $channel, string $eventType, array $payload): void
    {
        // intentionally empty
    }

    public function publishMany(array $channels, string 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key