Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | public function profile( |
||
16 | Request $request, |
||
17 | ORMInterface $orm, |
||
18 | Factory $factory |
||
19 | ) { |
||
20 | /** @var UserRepository $userRepo */ |
||
21 | $userRepo = $orm->getRepository(User::class); |
||
22 | $login = $request->getAttribute('login', null); |
||
23 | |||
24 | $item = $userRepo->findByLogin($login); |
||
25 | if ($item === null) { |
||
26 | return $factory->create(DeferredResponse::class, [['error' => 'Page not found']])->withStatus(404); |
||
27 | } |
||
28 | |||
29 | return $factory->create( |
||
30 | DeferredResponse::class, |
||
31 | [['login' => $item->getLogin(), 'created_at' => $item->getCreatedAt()->format('H:i:s d.m.Y')]] |
||
32 | ); |
||
35 |