ApiCompletedTasksController::update()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 2
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
9
class ApiCompletedTasksController extends Controller
10
{
11
    /**
12
     * @param StoreTask $request
13
     *
14
     * @return mixed
15
     */
16
    public function update(UpdateCompletedTask $request, Task $task)
17
    {
18
        $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

18
        $request->/** @scrutinizer ignore-call */ 
19
                  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...
19
        'completed' => 'required',
20
        ]);
21
22
        $task->completed = $request->completed;
23
        $task->save();
24
25
        return $task;
26
    }
27
}
28