StagesController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A list() 0 14 3
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use App\Models\Stage;
6
use Illuminate\Http\Request;
7
8
class StagesController extends Controller
9
{
10
    public function list(Request $request)
11
    {
12
        $recruitmentId = $request->get('recruitment_id');
0 ignored issues
show
Bug introduced by
The method get() does not exist on Illuminate\Http\Request. ( Ignorable by Annotation )

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

12
        /** @scrutinizer ignore-call */ 
13
        $recruitmentId = $request->get('recruitment_id');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
13
14
        if ($recruitmentId) {
15
            $stages = Stage::where('recruitment_id', $recruitmentId)->orderBy('order', 'ASC')->get();
16
            foreach ($stages as $stage) {
17
                $stage->recruitment_id = intval($recruitmentId);
18
            }
19
        } else {
20
            $stages = Stage::orderBy('id', 'ASC')->get();
21
        }
22
23
        return response()->json($stages);
24
    }
25
}
26