21 private $name =
'flashes';
28 private $flashes = array();
42 public function __construct($storageKey =
'_sf2_flashes')
44 $this->storageKey = $storageKey;
65 $this->flashes = &$flashes;
71 public function add($type, $message)
73 $this->flashes[$type][] = $message;
79 public function peek($type, array $default = array())
81 return $this->
has($type) ? $this->flashes[$type] : $default;
89 return $this->flashes;
95 public function get($type, array $default = array())
97 if (!$this->
has($type)) {
101 $return = $this->flashes[$type];
103 unset($this->flashes[$type]);
111 public function all()
114 $this->flashes = array();
122 public function set($type, $messages)
124 $this->flashes[$type] = (array) $messages;
130 public function setAll(array $messages)
132 $this->flashes = $messages;
138 public function has($type)
140 return array_key_exists($type, $this->flashes) && $this->flashes[$type];
146 public function keys()
148 return array_keys($this->flashes);
156 return $this->storageKey;
162 public function clear()