Updated Symfony HttpFoundation to 2.1.6.
This commit is contained in:
@@ -16,7 +16,7 @@ namespace Symfony\Component\HttpFoundation\Session\Flash;
|
||||
*
|
||||
* @author Drak <drak@zikula.org>
|
||||
*/
|
||||
class FlashBag implements FlashBagInterface
|
||||
class FlashBag implements FlashBagInterface, \IteratorAggregate, \Countable
|
||||
{
|
||||
private $name = 'flashes';
|
||||
|
||||
@@ -68,7 +68,15 @@ class FlashBag implements FlashBagInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function peek($type, $default = null)
|
||||
public function add($type, $message)
|
||||
{
|
||||
$this->flashes[$type][] = $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function peek($type, array $default =array())
|
||||
{
|
||||
return $this->has($type) ? $this->flashes[$type] : $default;
|
||||
}
|
||||
@@ -84,7 +92,7 @@ class FlashBag implements FlashBagInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get($type, $default = null)
|
||||
public function get($type, array $default = array())
|
||||
{
|
||||
if (!$this->has($type)) {
|
||||
return $default;
|
||||
@@ -111,9 +119,9 @@ class FlashBag implements FlashBagInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set($type, $message)
|
||||
public function set($type, $messages)
|
||||
{
|
||||
$this->flashes[$type] = $message;
|
||||
$this->flashes[$type] = (array) $messages;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,7 +137,7 @@ class FlashBag implements FlashBagInterface
|
||||
*/
|
||||
public function has($type)
|
||||
{
|
||||
return array_key_exists($type, $this->flashes);
|
||||
return array_key_exists($type, $this->flashes) && $this->flashes[$type];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,4 +163,24 @@ class FlashBag implements FlashBagInterface
|
||||
{
|
||||
return $this->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator for flashes.
|
||||
*
|
||||
* @return \ArrayIterator An \ArrayIterator instance
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new \ArrayIterator($this->all());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of flashes.
|
||||
*
|
||||
* @return int The number of flashes
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return count($this->flashes);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user