Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
StartCaptchaEndpoint
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 configure
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 handle
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Olz\Captcha\Endpoints;
4
5use Olz\Api\OlzTypedEndpoint;
6use Olz\Captcha\Utils\CaptchaUtils;
7
8/**
9 * @phpstan-import-type OlzCaptchaConfig from CaptchaUtils
10 *
11 * @extends OlzTypedEndpoint<
12 *   array{},
13 *   array{
14 *     config: OlzCaptchaConfig,
15 *   }
16 * >
17 */
18class StartCaptchaEndpoint extends OlzTypedEndpoint {
19    public function configure(): void {
20        parent::configure();
21        $this->phpStanUtils->registerTypeImport(CaptchaUtils::class);
22    }
23
24    protected function handle(mixed $input): mixed {
25        $config = $this->captchaUtils()->generateOlzCaptchaConfig(3);
26        return [
27            'config' => $config,
28        ];
29    }
30}