Completed
Push — master ( 57e181...a5086d )
by Mauro
02:27
created

CreateTask::createTask()   A

Complexity

Conditions 2
Paths 5

Size

Total Lines 12
Code Lines 8

Duplication

Lines 12
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 12
loc 12
rs 9.4285
cc 2
eloc 8
nc 5
nop 3
1
<?php
2
3
namespace App\Controller\Task;
4
5
/**
6
 * Create Task Controller.
7
 */
8 View Code Duplication
class CreateTask extends BaseTaskController
0 ignored issues
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
     * Create a task.
12
     *
13
     * @param Request $request
14
     * @param Response $response
15
     * @param array $args
16
     * @return array
17
     */
18
    public function createTask($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
            $input = $this->request->getParsedBody();
23
            $result = $this->getTaskService()->createTask($input);
24
25
            return $this->jsonResponse('success', $result, 201);
26
        } catch (\Exception $ex) {
27
            return $this->jsonResponse('error', $ex->getMessage(), $ex->getCode());
28
        }
29
    }
30
}
31