Completed
Push — master ( 460020...c44764 )
by Mauro
02:34
created

DeleteUser   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 2
dl 22
loc 22
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A deleteUser() 11 11 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace App\Controller\User;
4
5
/**
6
 * Delete User Controller.
7
 */
8 View Code Duplication
class DeleteUser extends BaseUser
1 ignored issue
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9
{
10
    /**
11
     * Delete a user.
12
     *
13
     * @param Request $request
14
     * @param Response $response
15
     * @param array $args
16
     * @return array
17
     */
18
    public function deleteUser($request, $response, $args)
0 ignored issues
show
Coding Style Best Practice introduced by
Please use __construct() instead of a PHP4-style constructor that is named after the class.
Loading history...
19
    {
20
        try {
21
            $this->setParams($request, $response, $args);
22
            $result = $this->getUserService()->deleteUser($this->args['id']);
23
24
            return $this->jsonResponse('success', $result, 200);
25
        } catch (\Exception $ex) {
26
            return $this->jsonResponse('error', $ex->getMessage(), $ex->getCode());
27
        }
28
    }
29
}
30