1 | <?php |
||
13 | class CalendarsController extends Controller |
||
14 | { |
||
15 | /** |
||
16 | * ExampleController constructor. |
||
17 | */ |
||
18 | 14 | public function __construct() |
|
24 | |||
25 | |||
26 | /** |
||
27 | * Display a listing of the resource. |
||
28 | * |
||
29 | * @return \Illuminate\Http\Response |
||
30 | */ |
||
31 | 2 | public function index() |
|
40 | |||
41 | /** |
||
42 | * Store a newly created resource in storage. |
||
43 | * |
||
44 | * @param CalendarRequest $request |
||
45 | * @return \Illuminate\Http\Response |
||
46 | */ |
||
47 | 2 | public function store(CalendarRequest $request) |
|
55 | |||
56 | /** |
||
57 | * Store a newly created resource in storage with caldav. |
||
58 | * |
||
59 | * @param CalendarRequest $request |
||
60 | * @return \Illuminate\Http\Response |
||
61 | */ |
||
62 | public function storeCaldav(CalendarRequest $request) |
||
75 | |||
76 | /** |
||
77 | * Display the specified resource. |
||
78 | * |
||
79 | * @param int $id |
||
80 | * @return \Illuminate\Http\Response |
||
81 | */ |
||
82 | 6 | public function show($id) |
|
89 | |||
90 | /** |
||
91 | * Update the specified resource in storage. |
||
92 | * |
||
93 | * @param CalendarRequest $request |
||
94 | * @param int $id |
||
95 | * @return \Illuminate\Http\Response |
||
96 | */ |
||
97 | 2 | public function update(CalendarRequest $request, $id) |
|
98 | { |
||
99 | // |
||
100 | 2 | $calendar = Calendar::findOrFail($id); |
|
101 | 2 | $this->authorize($calendar); |
|
102 | 2 | $input = $request->all(); |
|
|
|||
103 | 2 | $calendar->update($request->only('name', 'enabled')); |
|
104 | //TODO test |
||
105 | //TODO validator |
||
106 | 2 | $calendar->caldav()->update($request->only('url','username', 'password', 'calendar_name')); |
|
107 | 2 | return $calendar; |
|
108 | } |
||
109 | |||
110 | /** |
||
111 | * Remove the specified resource from storage. |
||
112 | * |
||
113 | * @param int $id |
||
114 | * @return \Illuminate\Http\Response |
||
115 | */ |
||
116 | 2 | public function destroy($id) |
|
124 | |||
125 | /** |
||
126 | * Return a list of calendars name of a specif caldav calendar |
||
127 | * @param Request $request |
||
128 | * @return \Illuminate\Http\Response |
||
129 | */ |
||
130 | public function getCalendars(Request $request) |
||
144 | } |
||
145 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.