This commit is contained in:
the-djmaze 2022-12-07 19:57:00 +01:00
parent 079f334bcc
commit 4397eaed86

View file

@ -21,8 +21,11 @@ abstract class SASL
final public static function factory(string $type)
{
if (\preg_match('/^([A-Z2]+)(?:-(.+))?$/Di', $type, $m)) {
if ('XOAUTH2' === $m[1] || 'OAUTHBEARER' === $m[1]) {
$m[1] = 'OAUTH';
}
$class = __CLASS__ . "\\{$m[1]}";
if (\class_exists($class)) {
if (\class_exists($class) && $class::isSupported($m[2] ?? '')) {
return new $class($m[2] ?? '');
}
}