Deprecated AbstractPicoPlugin::__call() in favour of PicoPluginInterface::getPico()

This commit is contained in:
Daniel Rudolf 2019-09-11 12:06:40 +02:00
parent 581a3a0609
commit fd97c70502
No known key found for this signature in database
GPG key ID: A061F02CD8DE4538

View file

@ -31,7 +31,7 @@ abstract class AbstractPicoPlugin implements PicoPluginInterface
* @see PicoPluginInterface::getPico() * @see PicoPluginInterface::getPico()
* @var Pico * @var Pico
*/ */
private $pico; protected $pico;
/** /**
* Boolean indicating if this plugin is enabled (TRUE) or disabled (FALSE) * Boolean indicating if this plugin is enabled (TRUE) or disabled (FALSE)
@ -184,7 +184,7 @@ abstract class AbstractPicoPlugin implements PicoPluginInterface
*/ */
public function getPluginConfig($configName = null, $default = null) public function getPluginConfig($configName = null, $default = null)
{ {
$pluginConfig = $this->getConfig(get_called_class(), array()); $pluginConfig = $this->getPico()->getConfig(get_called_class(), array());
if ($configName === null) { if ($configName === null) {
return $pluginConfig; return $pluginConfig;
@ -196,7 +196,9 @@ abstract class AbstractPicoPlugin implements PicoPluginInterface
/** /**
* Passes all not satisfiable method calls to Pico * Passes all not satisfiable method calls to Pico
* *
* @see Pico * @see PicoPluginInterface::getPico()
*
* @deprecated 3.0.0
* *
* @param string $methodName name of the method to call * @param string $methodName name of the method to call
* @param array $params parameters to pass * @param array $params parameters to pass
@ -228,7 +230,7 @@ abstract class AbstractPicoPlugin implements PicoPluginInterface
{ {
foreach ($this->getDependencies() as $pluginName) { foreach ($this->getDependencies() as $pluginName) {
try { try {
$plugin = $this->getPlugin($pluginName); $plugin = $this->getPico()->getPlugin($pluginName);
} catch (RuntimeException $e) { } catch (RuntimeException $e) {
throw new RuntimeException( throw new RuntimeException(
"Unable to enable plugin '" . get_called_class() . "': " "Unable to enable plugin '" . get_called_class() . "': "
@ -309,7 +311,7 @@ abstract class AbstractPicoPlugin implements PicoPluginInterface
{ {
if ($this->dependants === null) { if ($this->dependants === null) {
$this->dependants = array(); $this->dependants = array();
foreach ($this->getPlugins() as $pluginName => $plugin) { foreach ($this->getPico()->getPlugins() as $pluginName => $plugin) {
// only plugins which implement PicoPluginInterface support dependencies // only plugins which implement PicoPluginInterface support dependencies
if ($plugin instanceof PicoPluginInterface) { if ($plugin instanceof PicoPluginInterface) {
$dependencies = $plugin->getDependencies(); $dependencies = $plugin->getDependencies();