mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-01 14:30:32 +02: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:
@@ -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]);
|
||||
|
Reference in New Issue
Block a user