Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 1fec387a4317 |
children | af1871eacc83 |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
17 * @author Drak <drak@zikula.org> | 17 * @author Drak <drak@zikula.org> |
18 */ | 18 */ |
19 class AutoExpireFlashBag implements FlashBagInterface | 19 class AutoExpireFlashBag implements FlashBagInterface |
20 { | 20 { |
21 private $name = 'flashes'; | 21 private $name = 'flashes'; |
22 private $flashes = array('display' => array(), 'new' => array()); | 22 private $flashes = ['display' => [], 'new' => []]; |
23 private $storageKey; | 23 private $storageKey; |
24 | 24 |
25 /** | 25 /** |
26 * @param string $storageKey The key used to store flashes in the session | 26 * @param string $storageKey The key used to store flashes in the session |
27 */ | 27 */ |
51 $this->flashes = &$flashes; | 51 $this->flashes = &$flashes; |
52 | 52 |
53 // The logic: messages from the last request will be stored in new, so we move them to previous | 53 // The logic: messages from the last request will be stored in new, so we move them to previous |
54 // This request we will show what is in 'display'. What is placed into 'new' this time round will | 54 // This request we will show what is in 'display'. What is placed into 'new' this time round will |
55 // be moved to display next time round. | 55 // be moved to display next time round. |
56 $this->flashes['display'] = array_key_exists('new', $this->flashes) ? $this->flashes['new'] : array(); | 56 $this->flashes['display'] = array_key_exists('new', $this->flashes) ? $this->flashes['new'] : []; |
57 $this->flashes['new'] = array(); | 57 $this->flashes['new'] = []; |
58 } | 58 } |
59 | 59 |
60 /** | 60 /** |
61 * {@inheritdoc} | 61 * {@inheritdoc} |
62 */ | 62 */ |
66 } | 66 } |
67 | 67 |
68 /** | 68 /** |
69 * {@inheritdoc} | 69 * {@inheritdoc} |
70 */ | 70 */ |
71 public function peek($type, array $default = array()) | 71 public function peek($type, array $default = []) |
72 { | 72 { |
73 return $this->has($type) ? $this->flashes['display'][$type] : $default; | 73 return $this->has($type) ? $this->flashes['display'][$type] : $default; |
74 } | 74 } |
75 | 75 |
76 /** | 76 /** |
77 * {@inheritdoc} | 77 * {@inheritdoc} |
78 */ | 78 */ |
79 public function peekAll() | 79 public function peekAll() |
80 { | 80 { |
81 return array_key_exists('display', $this->flashes) ? (array) $this->flashes['display'] : array(); | 81 return array_key_exists('display', $this->flashes) ? (array) $this->flashes['display'] : []; |
82 } | 82 } |
83 | 83 |
84 /** | 84 /** |
85 * {@inheritdoc} | 85 * {@inheritdoc} |
86 */ | 86 */ |
87 public function get($type, array $default = array()) | 87 public function get($type, array $default = []) |
88 { | 88 { |
89 $return = $default; | 89 $return = $default; |
90 | 90 |
91 if (!$this->has($type)) { | 91 if (!$this->has($type)) { |
92 return $return; | 92 return $return; |
104 * {@inheritdoc} | 104 * {@inheritdoc} |
105 */ | 105 */ |
106 public function all() | 106 public function all() |
107 { | 107 { |
108 $return = $this->flashes['display']; | 108 $return = $this->flashes['display']; |
109 $this->flashes['display'] = array(); | 109 $this->flashes['display'] = []; |
110 | 110 |
111 return $return; | 111 return $return; |
112 } | 112 } |
113 | 113 |
114 /** | 114 /** |