Files
php-flasher/Middleware/AddCreatedAtStampMiddleware.php
T
KHOUBZA Younes 26d4ca787f update namespace
2020-12-03 09:15:47 +01:00

19 lines
440 B
PHP

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