mirror of
https://github.com/getgrav/grav.git
synced 2026-07-15 10:52:47 +02:00
Plugin class phpstan fix
This commit is contained in:
@@ -36,7 +36,7 @@ class Plugin implements EventSubscriberInterface, ArrayAccess
|
|||||||
|
|
||||||
/** @var Grav */
|
/** @var Grav */
|
||||||
protected $grav;
|
protected $grav;
|
||||||
/** @var Config|null */
|
/** @var Config */
|
||||||
protected $config;
|
protected $config;
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
protected $active = true;
|
protected $active = true;
|
||||||
@@ -74,9 +74,7 @@ class Plugin implements EventSubscriberInterface, ArrayAccess
|
|||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->grav = $grav;
|
$this->grav = $grav;
|
||||||
|
|
||||||
if ($config) {
|
$this->setConfig($config ?? $grav['config']);
|
||||||
$this->setConfig($config);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -97,7 +95,7 @@ class Plugin implements EventSubscriberInterface, ArrayAccess
|
|||||||
*/
|
*/
|
||||||
public function config()
|
public function config()
|
||||||
{
|
{
|
||||||
return null !== $this->config ? $this->config["plugins.{$this->name}"] : [];
|
return $this->config["plugins.{$this->name}"];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -132,8 +130,7 @@ class Plugin implements EventSubscriberInterface, ArrayAccess
|
|||||||
|
|
||||||
/** @var Uri $uri */
|
/** @var Uri $uri */
|
||||||
$uri = $this->grav['uri'];
|
$uri = $this->grav['uri'];
|
||||||
/** @var Config $config */
|
$config = $this->config;
|
||||||
$config = $this->config ?? $this->grav['config'];
|
|
||||||
|
|
||||||
if (strpos($uri->path(), $config->get('plugins.admin.route') . '/' . $plugin_route) === false) {
|
if (strpos($uri->path(), $config->get('plugins.admin.route') . '/' . $plugin_route) === false) {
|
||||||
$active = false;
|
$active = false;
|
||||||
@@ -307,8 +304,7 @@ class Plugin implements EventSubscriberInterface, ArrayAccess
|
|||||||
*/
|
*/
|
||||||
protected function mergeConfig(PageInterface $page, $deep = false, $params = [], $type = 'plugins')
|
protected function mergeConfig(PageInterface $page, $deep = false, $params = [], $type = 'plugins')
|
||||||
{
|
{
|
||||||
/** @var Config $config */
|
$config = $this->config;
|
||||||
$config = $this->config ?? $this->grav['config'];
|
|
||||||
|
|
||||||
$class_name = $this->name;
|
$class_name = $this->name;
|
||||||
$class_name_merged = $class_name . '.merged';
|
$class_name_merged = $class_name . '.merged';
|
||||||
|
|||||||
Reference in New Issue
Block a user