Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| LinkStravaEndpoint | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 1 |
| handle | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
12 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Olz\Api\Endpoints; |
| 4 | |
| 5 | use Olz\Api\OlzTypedEndpoint; |
| 6 | use PhpTypeScriptApi\HttpError; |
| 7 | |
| 8 | /** |
| 9 | * @extends OlzTypedEndpoint< |
| 10 | * array{ |
| 11 | * code: non-empty-string, |
| 12 | * }, |
| 13 | * array{} |
| 14 | * > |
| 15 | */ |
| 16 | class LinkStravaEndpoint extends OlzTypedEndpoint { |
| 17 | protected function handle(mixed $input): mixed { |
| 18 | $user = $this->authUtils()->getCurrentUser(); |
| 19 | if (!$user) { |
| 20 | throw new HttpError(403, "Kein Zugriff!"); |
| 21 | } |
| 22 | |
| 23 | $strava_link = $this->stravaUtils()->linkStrava($input['code']); |
| 24 | if ($strava_link === null) { |
| 25 | throw new HttpError(400, "Ungültige Anfrage!"); |
| 26 | } |
| 27 | |
| 28 | return []; |
| 29 | } |
| 30 | } |