1: <?php
2:
3: namespace Deimos\Cookie\Extensions;
4:
5: trait Flash
6: {
7:
8: protected $flashProperty = 'DeimosFlash';
9:
10: /**
11: * @param string $name
12: * @param mixed $value
13: * @param array $options
14: *
15: * @return mixed
16: *
17: * @throws \InvalidArgumentException
18: */
19: public function flash($name, $value = null, array $options = [])
20: {
21: $name .= $this->flashProperty;
22:
23: if ($value === null)
24: {
25: $value = $this->get($name, null, $options);
26: $this->remove($name);
27: }
28: else
29: {
30: $this->set($name, $value, $options);
31: }
32:
33: return $value;
34: }
35:
36: }