1 | <?php |
||
17 | class PhotosController extends BaseController |
||
18 | { |
||
19 | /** |
||
20 | * Render a set of Public HabboWEB Photos. |
||
21 | * |
||
22 | * @TODO: Exclude Approved Reported Photos from the List |
||
23 | * |
||
24 | * @return JsonResponse |
||
25 | */ |
||
26 | public function show(): JsonResponse |
||
30 | |||
31 | /** |
||
32 | * Register a Report of a Photo |
||
33 | * Observation.: We will not create a limit of max reports. |
||
34 | * Since it's a retro we don't really care about reports. |
||
35 | * |
||
36 | * @MODERATION: Reporting Status (0 = Not Reviewed, 1 = Report Approved, 2 = Report Not Approved |
||
37 | * |
||
38 | * @param Request $request |
||
39 | * @param int $photoId |
||
40 | * |
||
41 | * @return Response |
||
42 | */ |
||
43 | public function report(Request $request, int $photoId): Response |
||
49 | |||
50 | /** |
||
51 | * Like a Photo. |
||
52 | * |
||
53 | * @param int $photoId |
||
54 | * |
||
55 | * @return Response |
||
56 | */ |
||
57 | public function likePhoto(int $photoId): Response |
||
58 | { |
||
59 | if (PhotoLike::where('username', UserFacade::getUser()->name)->where('photo_id', $photoId)->count() > 0) { |
||
60 | return response(null); |
||
61 | } |
||
62 | |||
63 | (new PhotoLike())->store($photoId, UserFacade::getUser()->name); |
||
64 | |||
65 | return response(null); |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * Unlike a Photo. |
||
70 | * |
||
71 | * @param int $photoId |
||
72 | * |
||
73 | * @return Response |
||
74 | */ |
||
75 | public function unlikePhoto(int $photoId): Response |
||
76 | { |
||
77 | if (PhotoLike::where('username', UserFacade::getUser()->name)->where('photo_id', $photoId)->count() == 0) { |
||
78 | return response(null); |
||
79 | } |
||
80 | |||
81 | PhotoLike::where('username', UserFacade::getUser()->name)->where('photo_id', $photoId)->delete(); |
||
82 | |||
83 | return response(null); |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * Delete a Photo. |
||
88 | * |
||
89 | * @param int $photoId |
||
90 | * |
||
91 | * @return Response |
||
92 | */ |
||
93 | public function delete(int $photoId): Response |
||
105 | } |
||
106 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.