1<?php 2 3namespace dokuwiki\plugin\slacknotifier\helper; 4 5use dokuwiki\Extension\PluginInterface; 6 7/** 8 * A class to provide lazy access to plugin config 9 * 10 * @property string $namespaces 11 * @property string $webhook 12 * @property bool $notify_create 13 * @property bool $notify_edit 14 * @property bool $notify_delete 15 * @property bool $notify_edit_minor 16 * @property bool $show_summary 17 */ 18class Config 19{ 20 /** @var PluginInterface */ 21 private $plugin; 22 23 public function __construct(PluginInterface $plugin) 24 { 25 $this->plugin = $plugin; 26 } 27 28 public function __get($name) 29 { 30 return $this->plugin->getConf($name, null); 31 } 32 33 /** 34 * Return true if $namespace is configured as valid namespace. 35 */ 36 public function isValidNamespace(string $namespace): bool 37 { 38 if (!$this->namespaces) { 39 return true; 40 } 41 42 $namespaces = explode(',', $this->namespaces); 43 44 return in_array($namespace, $namespaces, true); 45 } 46} 47