FlashBagInterface.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. * Adds a flash message for type.
  21. *
  22. * @param string $type
  23. * @param string $message
  24. */
  25. public function add($type, $message);
  26. /**
  27. * Registers a message for a given type.
  28. *
  29. * @param string $type
  30. * @param string|array $message
  31. */
  32. public function set($type, $message);
  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. * @return array
  40. */
  41. public function peek($type, array $default = array());
  42. /**
  43. * Gets all flash messages.
  44. *
  45. * @return array
  46. */
  47. public function peekAll();
  48. /**
  49. * Gets and clears flash from the stack.
  50. *
  51. * @param string $type
  52. * @param array $default Default value if $type does not exist
  53. *
  54. * @return array
  55. */
  56. public function get($type, array $default = array());
  57. /**
  58. * Gets and clears flashes from the stack.
  59. *
  60. * @return array
  61. */
  62. public function all();
  63. /**
  64. * Sets all flash messages.
  65. *
  66. * @param array $messages
  67. */
  68. public function setAll(array $messages);
  69. /**
  70. * Has flash messages for a given type?
  71. *
  72. * @param string $type
  73. *
  74. * @return bool
  75. */
  76. public function has($type);
  77. /**
  78. * Returns a list of all defined types.
  79. *
  80. * @return array
  81. */
  82. public function keys();
  83. }