mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
[ticket/17414] Extend plugin interface and wrapper
PHPBB-17414
This commit is contained in:
@@ -13,6 +13,9 @@
|
||||
|
||||
namespace phpbb\captcha;
|
||||
|
||||
use phpbb\captcha\plugins\legacy_wrapper;
|
||||
use phpbb\captcha\plugins\plugin_interface;
|
||||
|
||||
class factory
|
||||
{
|
||||
/**
|
||||
@@ -41,11 +44,17 @@ class factory
|
||||
* Return a new instance of a given plugin
|
||||
*
|
||||
* @param $name
|
||||
* @return object|null
|
||||
* @return plugin_interface
|
||||
*/
|
||||
public function get_instance($name)
|
||||
public function get_instance($name): plugin_interface
|
||||
{
|
||||
return $this->container->get($name);
|
||||
$captcha = $this->container->get($name);
|
||||
if ($captcha instanceof plugin_interface)
|
||||
{
|
||||
return $captcha;
|
||||
}
|
||||
|
||||
return new legacy_wrapper($name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user