| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This file is part of the Symfony package. |
| 5 | * |
| 6 | * (c) Fabien Potencier <[email protected]> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | */ |
| 11 | |
| 12 | namespace Symfony\Component\HttpFoundation\Session\Flash; |
| 13 | |
| 14 | use Symfony\Component\HttpFoundation\Session\SessionBagInterface; |
| 15 | |
| 16 | /** |
| 17 | * FlashBagInterface. |
| 18 | * |
| 19 | * @author Drak <[email protected]> |
| 20 | */ |
| 21 | interface FlashBagInterface extends SessionBagInterface |
| 22 | { |
| 23 | /** |
| 24 | * Adds a flash message for the given type. |
| 25 | */ |
| 26 | public function add(string $type, mixed $message): void; |
| 27 | |
| 28 | /** |
| 29 | * Registers one or more messages for a given type. |
| 30 | */ |
| 31 | public function set(string $type, string|array $messages): void; |
| 32 | |
| 33 | /** |
| 34 | * Gets flash messages for a given type. |
| 35 | * |
| 36 | * @param string $type Message category type |
| 37 | * @param array $default Default value if $type does not exist |
| 38 | */ |
| 39 | public function peek(string $type, array $default = []): array; |
| 40 | |
| 41 | /** |
| 42 | * Gets all flash messages. |
| 43 | */ |
| 44 | public function peekAll(): array; |
| 45 | |
| 46 | /** |
| 47 | * Gets and clears flash from the stack. |
| 48 | * |
| 49 | * @param array $default Default value if $type does not exist |
| 50 | */ |
| 51 | public function get(string $type, array $default = []): array; |
| 52 | |
| 53 | /** |
| 54 | * Gets and clears flashes from the stack. |
| 55 | */ |
| 56 | public function all(): array; |
| 57 | |
| 58 | /** |
| 59 | * Sets all flash messages. |
| 60 | */ |
| 61 | public function setAll(array $messages): void; |
| 62 | |
| 63 | /** |
| 64 | * Has flash messages for a given type? |
| 65 | */ |
| 66 | public function has(string $type): bool; |
| 67 | |
| 68 | /** |
| 69 | * Returns a list of all defined types. |
| 70 | */ |
| 71 | public function keys(): array; |
| 72 | } |