1<?php 2 3namespace dokuwiki\plugin\slacknotifier\event; 4 5use dokuwiki\Extension\Event; 6use InvalidArgumentException; 7 8abstract class BaseEvent 9{ 10 /** @var array */ 11 private $data; 12 13 public function __construct(Event $event) 14 { 15 $this->data = $event->data; 16 } 17 18 public function __get(string $name) 19 { 20 if (!array_key_exists($name, $this->data)) { 21 throw new InvalidArgumentException("Invalid property: $name"); 22 } 23 24 return $this->data[$name]; 25 } 26 27 public function __set(string $name, $value) 28 { 29 if (!array_key_exists($name, $this->data)) { 30 throw new InvalidArgumentException("Invalid property: $name"); 31 } 32 33 $this->data[$name] = $value; 34 } 35} 36