[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 * This file is part of the Symfony package. 5 * 6 * (c) Fabien Potencier <fabien@symfony.com> 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12 namespace Symfony\Component\HttpFoundation\Session\Flash; 13 14 /** 15 * FlashBag flash message container. 16 * 17 * \IteratorAggregate implementation is deprecated and will be removed in 3.0. 18 * 19 * @author Drak <drak@zikula.org> 20 */ 21 class FlashBag implements FlashBagInterface, \IteratorAggregate 22 { 23 private $name = 'flashes'; 24 private $flashes = array(); 25 private $storageKey; 26 27 /** 28 * @param string $storageKey The key used to store flashes in the session 29 */ 30 public function __construct($storageKey = '_sf2_flashes') 31 { 32 $this->storageKey = $storageKey; 33 } 34 35 /** 36 * {@inheritdoc} 37 */ 38 public function getName() 39 { 40 return $this->name; 41 } 42 43 public function setName($name) 44 { 45 $this->name = $name; 46 } 47 48 /** 49 * {@inheritdoc} 50 */ 51 public function initialize(array &$flashes) 52 { 53 $this->flashes = &$flashes; 54 } 55 56 /** 57 * {@inheritdoc} 58 */ 59 public function add($type, $message) 60 { 61 $this->flashes[$type][] = $message; 62 } 63 64 /** 65 * {@inheritdoc} 66 */ 67 public function peek($type, array $default = array()) 68 { 69 return $this->has($type) ? $this->flashes[$type] : $default; 70 } 71 72 /** 73 * {@inheritdoc} 74 */ 75 public function peekAll() 76 { 77 return $this->flashes; 78 } 79 80 /** 81 * {@inheritdoc} 82 */ 83 public function get($type, array $default = array()) 84 { 85 if (!$this->has($type)) { 86 return $default; 87 } 88 89 $return = $this->flashes[$type]; 90 91 unset($this->flashes[$type]); 92 93 return $return; 94 } 95 96 /** 97 * {@inheritdoc} 98 */ 99 public function all() 100 { 101 $return = $this->peekAll(); 102 $this->flashes = array(); 103 104 return $return; 105 } 106 107 /** 108 * {@inheritdoc} 109 */ 110 public function set($type, $messages) 111 { 112 $this->flashes[$type] = (array) $messages; 113 } 114 115 /** 116 * {@inheritdoc} 117 */ 118 public function setAll(array $messages) 119 { 120 $this->flashes = $messages; 121 } 122 123 /** 124 * {@inheritdoc} 125 */ 126 public function has($type) 127 { 128 return array_key_exists($type, $this->flashes) && $this->flashes[$type]; 129 } 130 131 /** 132 * {@inheritdoc} 133 */ 134 public function keys() 135 { 136 return array_keys($this->flashes); 137 } 138 139 /** 140 * {@inheritdoc} 141 */ 142 public function getStorageKey() 143 { 144 return $this->storageKey; 145 } 146 147 /** 148 * {@inheritdoc} 149 */ 150 public function clear() 151 { 152 return $this->all(); 153 } 154 155 /** 156 * Returns an iterator for flashes. 157 * 158 * @deprecated since version 2.4, to be removed in 3.0. 159 * 160 * @return \ArrayIterator An \ArrayIterator instance 161 */ 162 public function getIterator() 163 { 164 @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.4 and will be removed in 3.0.', E_USER_DEPRECATED); 165 166 return new \ArrayIterator($this->all()); 167 } 168 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |