These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace App\Controller\Task; |
||
4 | |||
5 | use Slim\Http\Request; |
||
6 | use Slim\Http\Response; |
||
7 | |||
8 | /** |
||
9 | * Get One Task Controller. |
||
10 | */ |
||
11 | View Code Duplication | class GetOneTask extends BaseTask |
|
0 ignored issues
–
show
|
|||
12 | { |
||
13 | /** |
||
14 | * Get one task by id. |
||
15 | * |
||
16 | * @param Request $request |
||
17 | * @param Response $response |
||
18 | * @param array $args |
||
19 | * @return Response |
||
20 | */ |
||
21 | public function __invoke($request, $response, $args) |
||
22 | { |
||
23 | $this->setParams($request, $response, $args); |
||
24 | $taskId = $this->args['id']; |
||
25 | $result = $this->getTaskService()->getTask($taskId); |
||
26 | |||
27 | return $this->jsonResponse('success', $result, 200); |
||
28 | } |
||
29 | } |
||
30 |
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.