[ Index ]

PHP Cross Reference of phpBB-3.2.8-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  	public function offsetExists($offset)
  48      {
  49          return isset($this->data[$offset]);
  50      }
  51  
  52  	public function offsetGet($offset)
  53      {
  54          return isset($this->data[$offset]) ? $this->data[$offset] : null;
  55      }
  56  
  57  	public function offsetSet($offset, $value)
  58      {
  59          $this->data[$offset] = $value;
  60      }
  61  
  62  	public function offsetUnset($offset)
  63      {
  64          unset($this->data[$offset]);
  65      }
  66  
  67      /**
  68       * Returns data with updated key in specified offset.
  69       *
  70       * @param    string    $subarray    Data array subarray
  71       * @param    string    $key        Subarray key
  72       * @param    mixed    $value        Value to update
  73       */
  74  	public function update_subarray($subarray, $key, $value)
  75      {
  76          $this->data[$subarray][$key] = $value;
  77      }
  78  }


Generated: Tue Apr 7 19:42:26 2020 Cross-referenced by PHPXref 0.7.1