public function unregisterPlugin(SimpleFactoryInterface $factory) { if ($this->registered) { $this->unregister($factory); $this->registered = false; } return $this; }