| Total Complexity | 5 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class ApiUserController |
||
| 15 | { |
||
| 16 | private DataResponseFactoryInterface $responseFactory; |
||
| 17 | |||
| 18 | public function __construct(DataResponseFactoryInterface $responseFactory) |
||
| 19 | { |
||
| 20 | $this->responseFactory = $responseFactory; |
||
| 21 | } |
||
| 22 | |||
| 23 | public function index(UserRepository $userRepository): ResponseInterface |
||
| 24 | { |
||
| 25 | $dataReader = $userRepository->findAll()->withSort(Sort::only(['login'])->withOrderString('login')); |
||
| 26 | $users = $dataReader->read(); |
||
| 27 | |||
| 28 | $items = []; |
||
| 29 | foreach ($users as $user) { |
||
| 30 | $items[] = ['login' => $user->getLogin(), 'created_at' => $user->getCreatedAt()->format('H:i:s d.m.Y')]; |
||
| 31 | } |
||
| 32 | |||
| 33 | return $this->responseFactory->createResponse($items); |
||
| 34 | } |
||
| 35 | |||
| 36 | public function profile(ServerRequestInterface $request, UserRepository $userRepository): ResponseInterface |
||
| 48 | ); |
||
| 49 | } |
||
| 50 | } |
||
| 51 |