Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/event-dispatcher/GenericEvent.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
18 * | 18 * |
19 * @author Drak <drak@zikula.org> | 19 * @author Drak <drak@zikula.org> |
20 */ | 20 */ |
21 class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate | 21 class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate |
22 { | 22 { |
23 /** | |
24 * Event subject. | |
25 * | |
26 * @var mixed usually object or callable | |
27 */ | |
28 protected $subject; | 23 protected $subject; |
29 | |
30 /** | |
31 * Array of arguments. | |
32 * | |
33 * @var array | |
34 */ | |
35 protected $arguments; | 24 protected $arguments; |
36 | 25 |
37 /** | 26 /** |
38 * Encapsulate an event with $subject and $args. | 27 * Encapsulate an event with $subject and $args. |
39 * | 28 * |
40 * @param mixed $subject The subject of the event, usually an object | 29 * @param mixed $subject The subject of the event, usually an object or a callable |
41 * @param array $arguments Arguments to store in the event | 30 * @param array $arguments Arguments to store in the event |
42 */ | 31 */ |
43 public function __construct($subject = null, array $arguments = array()) | 32 public function __construct($subject = null, array $arguments = array()) |
44 { | 33 { |
45 $this->subject = $subject; | 34 $this->subject = $subject; |
61 * | 50 * |
62 * @param string $key Key | 51 * @param string $key Key |
63 * | 52 * |
64 * @return mixed Contents of array key | 53 * @return mixed Contents of array key |
65 * | 54 * |
66 * @throws \InvalidArgumentException If key is not found. | 55 * @throws \InvalidArgumentException if key is not found |
67 */ | 56 */ |
68 public function getArgument($key) | 57 public function getArgument($key) |
69 { | 58 { |
70 if ($this->hasArgument($key)) { | 59 if ($this->hasArgument($key)) { |
71 return $this->arguments[$key]; | 60 return $this->arguments[$key]; |
130 * | 119 * |
131 * @param string $key Array key | 120 * @param string $key Array key |
132 * | 121 * |
133 * @return mixed | 122 * @return mixed |
134 * | 123 * |
135 * @throws \InvalidArgumentException If key does not exist in $this->args. | 124 * @throws \InvalidArgumentException if key does not exist in $this->args |
136 */ | 125 */ |
137 public function offsetGet($key) | 126 public function offsetGet($key) |
138 { | 127 { |
139 return $this->getArgument($key); | 128 return $this->getArgument($key); |
140 } | 129 } |