25 lines
512 B
PHP
25 lines
512 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
final class UserGetController extends AbstractController
|
|
{
|
|
protected string $route = '/api/v1/user/{userId}';
|
|
|
|
private int $userId;
|
|
|
|
public function __construct(string $url)
|
|
{
|
|
parent::__construct($url);
|
|
|
|
$this->userId = (int)$this->getUrlParamInt('userId');
|
|
}
|
|
|
|
public function handle(): void
|
|
{
|
|
$user = new User($this->userId);
|
|
|
|
$this->response = new ApiJsonResponse();
|
|
$this->response->setResult($user);
|
|
}
|
|
} |