1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2025-02-17 11:28:41 +01:00

context.php: fix missing include file

This commit is contained in:
Zankaria 2024-10-16 22:49:19 +02:00
parent c1307feeb5
commit 76f6c721e9

View File

@ -1,8 +1,7 @@
<?php <?php
namespace Vichan; namespace Vichan;
use RuntimeException; use Vichan\Data\Driver\{CacheDriver, HttpDriver, ErrorLogLogDriver, FileLogDriver, LogDriver, StderrLogDriver, SyslogLogDriver};
use Vichan\Data\Driver\{HttpDriver, ErrorLogLogDriver, FileLogDriver, LogDriver, StderrLogDriver, SyslogLogDriver};
use Vichan\Service\HCaptchaQuery; use Vichan\Service\HCaptchaQuery;
use Vichan\Service\NativeCaptchaQuery; use Vichan\Service\NativeCaptchaQuery;
use Vichan\Service\ReCaptchaQuery; use Vichan\Service\ReCaptchaQuery;
@ -19,7 +18,7 @@ class Context {
public function get(string $name): mixed { public function get(string $name): mixed {
if (!isset($this->definitions[$name])) { if (!isset($this->definitions[$name])) {
throw new RuntimeException("Could not find a dependency named $name"); throw new \RuntimeException("Could not find a dependency named $name");
} }
$ret = $this->definitions[$name]; $ret = $this->definitions[$name];
@ -69,13 +68,13 @@ function build_context(array $config): Context {
$config['captcha']['hcaptcha']['sitekey'] $config['captcha']['hcaptcha']['sitekey']
); );
default: default:
throw new RuntimeException('No remote captcha service available'); throw new \RuntimeException('No remote captcha service available');
} }
}, },
NativeCaptchaQuery::class => function($c) { NativeCaptchaQuery::class => function($c) {
$config = $c->get('config'); $config = $c->get('config');
if ($config['captcha']['provider'] !== 'native') { if ($config['captcha']['provider'] !== 'native') {
throw new RuntimeException('No native captcha service available'); throw new \RuntimeException('No native captcha service available');
} }
return new NativeCaptchaQuery( return new NativeCaptchaQuery(
$c->get(HttpDriver::class), $c->get(HttpDriver::class),