|
|
@@ -10,7 +10,8 @@ trait ConfigTrait
|
|
|
public function __construct(private readonly ExtensionManager $extensionManager, private array $options = [])
|
|
|
{
|
|
|
}
|
|
|
- public function getConfig(string $key = null): mixed
|
|
|
+
|
|
|
+ public function getConfig(string $key = null, mixed $default = null): mixed
|
|
|
{
|
|
|
if (empty($this->options)) {
|
|
|
if (!method_exists($this, 'getExtensionID')) {
|
|
|
@@ -21,8 +22,9 @@ trait ConfigTrait
|
|
|
$this->options = array_merge($this->options, $this->getOptions());
|
|
|
}
|
|
|
}
|
|
|
- return $key ? ($this->options[$key] ?? null) : $this->options;
|
|
|
+ return $key ? ($this->options[$key] ?? $default) : $this->options;
|
|
|
}
|
|
|
+
|
|
|
public function __get(string $name): mixed
|
|
|
{
|
|
|
return $this->getConfig($name);
|