AttributeBagInterface.php 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 bool true if the attribute is defined, false otherwise
  25. */
  26. public 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. public function get($name, $default = null);
  36. /**
  37. * Sets an attribute.
  38. *
  39. * @param string $name
  40. * @param mixed $value
  41. */
  42. public function set($name, $value);
  43. /**
  44. * Returns attributes.
  45. *
  46. * @return array Attributes
  47. */
  48. public function all();
  49. /**
  50. * Sets attributes.
  51. *
  52. * @param array $attributes Attributes
  53. */
  54. public function replace(array $attributes);
  55. /**
  56. * Removes an attribute.
  57. *
  58. * @param string $name
  59. *
  60. * @return mixed The removed value or null when it does not exist
  61. */
  62. public function remove($name);
  63. }