1
0
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:
Marc Alexander
2024-10-04 13:42:45 +02:00
parent 15b51e3b8f
commit e84e9cace4
5 changed files with 119 additions and 16 deletions

View File

@@ -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);
}
/**