Completed
Branch v2.0.0 (f654ea)
by Alexander
01:15
created

UsersController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 27
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 11 1
A retrieve() 0 7 1
A usersList() 0 4 1
1
<?php
2
3
namespace Api\Controllers;
4
5
use Api\ApiController;
6
use Domain\User\UserClientService;
7
8
class UsersController extends ApiController
9
{
10
    public function create()
11
    {
12
        $data = $this->request->getJsonRawBody();
13
14
        $service = new UserClientService($this->getDi());
15
        $id = $service->createUser($data);
16
17
        $this->response->setStatusCode(201);
18
19
        return $this->json(['id' => $id]);
20
    }
21
22
    public function retrieve($id)
23
    {
24
        $service = new UserClientService($this->getDi());
25
        $user = $service->retrieveUserObject(['id' => $id]);
26
27
        return $this->json(['user' => $user]);
28
    }
29
30
    public function usersList()
31
    {
32
        return $this->json([]);
33
    }
34
}
35