[ Index ]

PHP Cross Reference of phpBB-3.3.12-deutsch

title

Body

[close]

/phpbb/event/ -> data.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  namespace phpbb\event;
  15  
  16  use Symfony\Component\EventDispatcher\Event;
  17  
  18  class data extends Event implements \ArrayAccess
  19  {
  20      private $data;
  21  
  22  	public function __construct(array $data = array())
  23      {
  24          $this->set_data($data);
  25      }
  26  
  27  	public function set_data(array $data = array())
  28      {
  29          $this->data = $data;
  30      }
  31  
  32  	public function get_data()
  33      {
  34          return $this->data;
  35      }
  36  
  37      /**
  38       * Returns data filtered to only include specified keys.
  39       *
  40       * This effectively discards any keys added to data by hooks.
  41       */
  42  	public function get_data_filtered($keys)
  43      {
  44          return array_intersect_key($this->data, array_flip($keys));
  45      }
  46  
  47      #[\ReturnTypeWillChange]
  48  	public function offsetExists($offset)
  49      {
  50          return isset($this->data[$offset]);
  51      }
  52  
  53      #[\ReturnTypeWillChange]
  54  	public function offsetGet($offset)
  55      {
  56          return isset($this->data[$offset]) ? $this->data[$offset] : null;
  57      }
  58  
  59      #[\ReturnTypeWillChange]
  60  	public function offsetSet($offset, $value)
  61      {
  62          $this->data[$offset] = $value;
  63      }
  64  
  65      #[\ReturnTypeWillChange]
  66  	public function offsetUnset($offset)
  67      {
  68          unset($this->data[$offset]);
  69      }
  70  
  71      /**
  72       * Returns data with updated key in specified offset.
  73       *
  74       * @param    string    $subarray    Data array subarray
  75       * @param    string    $key        Subarray key
  76       * @param    mixed    $value        Value to update
  77       */
  78  	public function update_subarray($subarray, $key, $value)
  79      {
  80          $this->data[$subarray][$key] = $value;
  81      }
  82  }


Generated: Sun Jun 23 12:25:44 2024 Cross-referenced by PHPXref 0.7.1