📁 File Manager Pro
v10.0.3 | PHP: 8.2.31
Server: LiteSpeed
2026-07-03 12:48:53
📂
/ (Root)
/
home
/
orkouolp
/
web
/
testing.orkobd
/
laravel
/
vendor
/
php-flasher
/
flasher
/
Http
📍 /home/orkouolp/web/testing.orkobd/laravel/vendor/php-flasher/flasher/Http
🔄 Refresh
✏️
Editing: RequestExtension.php
Writable
<?php declare(strict_types=1); namespace Flasher\Prime\Http; use Flasher\Prime\FlasherInterface; final readonly class RequestExtension implements RequestExtensionInterface { /** * @var array<string, string> */ private array $mapping; /** * @param array<string, string[]> $mapping */ public function __construct(private FlasherInterface $flasher, array $mapping = []) { $this->mapping = $this->flatMapping($mapping); } public function flash(RequestInterface $request, ResponseInterface $response): ResponseInterface { if (!$request->hasSession()) { return $response; } $this->processRequest($request); return $response; } /** * @param array<string, string[]> $mapping * * @return array<string, string> */ private function flatMapping(array $mapping): array { $flatMapping = []; foreach ($mapping as $type => $aliases) { foreach ($aliases as $alias) { $flatMapping[$alias] = $type; } } return $flatMapping; } /** * Process the request and flash messages. */ private function processRequest(RequestInterface $request): void { foreach ($this->mapping as $alias => $type) { if (!$request->hasType($alias)) { continue; } $messages = (array) $request->getType($alias); foreach ($messages as $message) { $this->flasher->flash($type, $message); } $request->forgetType($alias); } } }
💾 Save Changes
❌ Cancel