Skip to content

Commit

Permalink
update a way of interaction with plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
easy-system committed Jun 15, 2016
1 parent 60dccb3 commit 314cff4
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions src/PluginsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,14 @@
*/
trait PluginsTrait
{
/**
* The plugins of controller.
*
* @var \Es\Mvc\ControllerPluginsInterface
*/
protected $plugins;

/**
* Sets the plugins.
*
* @param \Es\Mvc\ControllerPluginsInterface $plugins The plugins
*/
public function setPlugins(ControllerPluginsInterface $plugins)
{
$this->plugins = $plugins;
Provider::getServices()->set('ControllerPlugins', $plugins);
}

/**
Expand All @@ -41,13 +34,7 @@ public function setPlugins(ControllerPluginsInterface $plugins)
*/
public function getPlugins()
{
if (! $this->plugins) {
$services = Provider::getServices();
$plugins = $services->get('ControllerPlugins');
$this->setPlugins($plugins);
}

return $this->plugins;
return Provider::getServices()->get('ControllerPlugins');
}

/**
Expand Down

0 comments on commit 314cff4

Please sign in to comment.