FlashBagInterface.php 1.7 KB

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