FlashBagInterface.php
94 lines
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This file is part of the Symfony package. |
| 5 | * |
| 6 | * (c) Fabien Potencier <fabien@symfony.com> |
| 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 <drak@zikula.org> |
| 20 | */ |
| 21 | interface FlashBagInterface extends SessionBagInterface |
| 22 | { |
| 23 | /** |
| 24 | * Adds a flash message for the given type. |
| 25 | * |
| 26 | * @param string $type |
| 27 | * @param mixed $message |
| 28 | */ |
| 29 | public function add($type, $message); |
| 30 | |
| 31 | /** |
| 32 | * Registers one or more messages for a given type. |
| 33 | * |
| 34 | * @param string $type |
| 35 | * @param string|array $messages |
| 36 | */ |
| 37 | public function set($type, $messages); |
| 38 | |
| 39 | /** |
| 40 | * Gets flash messages for a given type. |
| 41 | * |
| 42 | * @param string $type Message category type |
| 43 | * @param array $default Default value if $type does not exist |
| 44 | * |
| 45 | * @return array |
| 46 | */ |
| 47 | public function peek($type, array $default = []); |
| 48 | |
| 49 | /** |
| 50 | * Gets all flash messages. |
| 51 | * |
| 52 | * @return array |
| 53 | */ |
| 54 | public function peekAll(); |
| 55 | |
| 56 | /** |
| 57 | * Gets and clears flash from the stack. |
| 58 | * |
| 59 | * @param string $type |
| 60 | * @param array $default Default value if $type does not exist |
| 61 | * |
| 62 | * @return array |
| 63 | */ |
| 64 | public function get($type, array $default = []); |
| 65 | |
| 66 | /** |
| 67 | * Gets and clears flashes from the stack. |
| 68 | * |
| 69 | * @return array |
| 70 | */ |
| 71 | public function all(); |
| 72 | |
| 73 | /** |
| 74 | * Sets all flash messages. |
| 75 | */ |
| 76 | public function setAll(array $messages); |
| 77 | |
| 78 | /** |
| 79 | * Has flash messages for a given type? |
| 80 | * |
| 81 | * @param string $type |
| 82 | * |
| 83 | * @return bool |
| 84 | */ |
| 85 | public function has($type); |
| 86 | |
| 87 | /** |
| 88 | * Returns a list of all defined types. |
| 89 | * |
| 90 | * @return array |
| 91 | */ |
| 92 | public function keys(); |
| 93 | } |
| 94 |