Files
php-flasher/Middleware/AddDelayStampMiddleware.php
T
2020-12-06 14:04:54 +01:00

19 lines
425 B
PHP

<?php
namespace Flasher\Prime\Middleware;
use Flasher\Prime\Envelope;
use Flasher\Prime\Stamp\DelayStamp;
final class AddDelayStampMiddleware implements MiddlewareInterface
{
public function handle(Envelope $envelope, callable $next)
{
if (null === $envelope->get('Flasher\Prime\Stamp\DelayStamp')) {
$envelope->withStamp(new DelayStamp(0));
}
return $next($envelope);
}
}