Completed
Push — master ( f69477...ca1afd )
by Quim González
04:32
created

ApiCompletedTasksController::update()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 2
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use App\Http\Requests\StoreTask;
6
use App\Http\Requests\UpdateCompletedTask;
7
use App\Task;
8
use Illuminate\Http\Request;
9
10
class ApiCompletedTasksController extends Controller
11
{
12
    /**
13
     * @param StoreTask $request
14
     * @return mixed
15
     */
16
    public function update(UpdateCompletedTask $request, Task $task)
17
    {
18
19
20
        $request->validate([
0 ignored issues
show
Unused Code introduced by
The call to Illuminate\Foundation\Http\FormRequest::validate() has too many arguments starting with array('completed' => 'required'). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
        $request->/** @scrutinizer ignore-call */ 
21
                  validate([

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
21
        'completed' => 'required',
22
        ]);
23
24
        $task->completed = $request->completed;
25
        $task->save();
26
27
        return $task;
28
29
    }
30
}
31