UserSettingsRetrieveApplication::run()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 10
ccs 4
cts 4
cp 1
rs 10
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Uxmp\Core\Api\User;
6
7
use Psr\Http\Message\ResponseInterface;
8
use Psr\Http\Message\ServerRequestInterface;
9
use Uxmp\Core\Api\AbstractApiApplication;
10
use Uxmp\Core\Api\Lib\Message\JsonEnabledResponseInterface;
11
use Uxmp\Core\Api\Lib\Middleware\SessionValidatorMiddleware;
12
use Uxmp\Core\Orm\Model\UserInterface;
13
14
/**
15
 * Delivers the user settings
16
 */
17
final class UserSettingsRetrieveApplication extends AbstractApiApplication
18
{
19 1
    protected function run(
20
        ServerRequestInterface $request,
21
        JsonEnabledResponseInterface $response,
22
        array $args
23
    ): ResponseInterface {
24
        /** @var UserInterface $user */
25 1
        $user = $request->getAttribute(SessionValidatorMiddleware::USER);
26
27 1
        return $response->withJson([
28 1
            'language' => $user->getLanguage(),
29 1
        ]);
30
    }
31
}
32