AttributeBagInterface.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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\Attribute;
  11. use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
  12. /**
  13. * Attributes store.
  14. *
  15. * @author Drak <drak@zikula.org>
  16. */
  17. interface AttributeBagInterface extends SessionBagInterface
  18. {
  19. /**
  20. * Checks if an attribute is defined.
  21. *
  22. * @param string $name The attribute name
  23. *
  24. * @return Boolean true if the attribute is defined, false otherwise
  25. */
  26. function has($name);
  27. /**
  28. * Returns an attribute.
  29. *
  30. * @param string $name The attribute name
  31. * @param mixed $default The default value if not found.
  32. *
  33. * @return mixed
  34. */
  35. function get($name, $default = null);
  36. /**
  37. * Sets an attribute.
  38. *
  39. * @param string $name
  40. * @param mixed $value
  41. */
  42. function set($name, $value);
  43. /**
  44. * Returns attributes.
  45. *
  46. * @return array Attributes
  47. */
  48. function all();
  49. /**
  50. * Sets attributes.
  51. *
  52. * @param array $attributes Attributes
  53. */
  54. function replace(array $attributes);
  55. /**
  56. * Removes an attribute.
  57. *
  58. * @param string $name
  59. *
  60. * @return mixed The removed value
  61. */
  62. function remove($name);
  63. }