mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[feature/event-dispatcher] Add get_data_filtered function to event data.
Its purpose is to discard any keys added by hooks to data stored in the event, such that only keys that the ledge knows how to handle are processed. PHPBB3-9550
This commit is contained in:
parent
fbf34f16ab
commit
be23445b8c
1 changed files with 10 additions and 0 deletions
|
@ -36,6 +36,16 @@ class phpbb_event_data extends Event implements ArrayAccess
|
|||
return $this->data;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns data filtered to only include specified keys.
|
||||
*
|
||||
* This effectively discards any keys added to data by hooks.
|
||||
*/
|
||||
public function get_data_filtered($keys)
|
||||
{
|
||||
return array_intersect_key($this->data, array_flip($keys));
|
||||
}
|
||||
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->data[$offset]);
|
||||
|
|
Loading…
Add table
Reference in a new issue