AttributeBagInterface.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. * @return bool
  23. */
  24. public function has(string $name);
  25. /**
  26. * Returns an attribute.
  27. *
  28. * @param mixed $default The default value if not found
  29. *
  30. * @return mixed
  31. */
  32. public function get(string $name, $default = null);
  33. /**
  34. * Sets an attribute.
  35. *
  36. * @param mixed $value
  37. */
  38. public function set(string $name, $value);
  39. /**
  40. * Returns attributes.
  41. *
  42. * @return array<string, mixed>
  43. */
  44. public function all();
  45. public function replace(array $attributes);
  46. /**
  47. * Removes an attribute.
  48. *
  49. * @return mixed The removed value or null when it does not exist
  50. */
  51. public function remove(string $name);
  52. }