1 | <?php |
|||||||||||||
2 | ||||||||||||||
3 | namespace Evilnet\Inbox; |
|||||||||||||
4 | use Evilnet\Inbox\Controller; |
|||||||||||||
5 | use Evilnet\Inbox\Services\InboxService; |
|||||||||||||
6 | use Illuminate\Http\Request; |
|||||||||||||
0 ignored issues
–
show
|
||||||||||||||
7 | ||||||||||||||
8 | class InboxController extends Controller |
|||||||||||||
9 | { |
|||||||||||||
10 | ||||||||||||||
11 | protected $inboxService; |
|||||||||||||
12 | ||||||||||||||
13 | public function __construct(InboxService $inboxService) |
|||||||||||||
14 | { |
|||||||||||||
15 | $this->inboxService = $inboxService; |
|||||||||||||
16 | } |
|||||||||||||
17 | ||||||||||||||
18 | /** |
|||||||||||||
19 | * Display a listing of the resource. |
|||||||||||||
20 | * |
|||||||||||||
21 | * @return \Illuminate\Http\Response |
|||||||||||||
0 ignored issues
–
show
The type
Illuminate\Http\Response was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
||||||||||||||
22 | */ |
|||||||||||||
23 | public function index() |
|||||||||||||
24 | { |
|||||||||||||
25 | $conversations = $this->inboxService->fetchAllConversation(); |
|||||||||||||
26 | ||||||||||||||
27 | $users = $this->inboxService->getInboxUsers($conversations); |
|||||||||||||
28 | ||||||||||||||
29 | ||||||||||||||
30 | return view('inbox::inbox.index', compact('conversations', 'users')); |
|||||||||||||
0 ignored issues
–
show
The function
view was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
||||||||||||||
31 | } |
|||||||||||||
32 | /** |
|||||||||||||
33 | * Show the form for creating a new resource. |
|||||||||||||
34 | * |
|||||||||||||
35 | * @return \Illuminate\Http\Response |
|||||||||||||
36 | */ |
|||||||||||||
37 | public function create() |
|||||||||||||
38 | { |
|||||||||||||
39 | return view('inbox::inbox.create'); |
|||||||||||||
0 ignored issues
–
show
The function
view was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
||||||||||||||
40 | } |
|||||||||||||
41 | ||||||||||||||
42 | /** |
|||||||||||||
43 | * Store a newly created resource in storage. |
|||||||||||||
44 | * |
|||||||||||||
45 | * @param \Illuminate\Http\Request $request |
|||||||||||||
46 | * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\Response |
|||||||||||||
0 ignored issues
–
show
The type
Illuminate\Http\RedirectResponse was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
||||||||||||||
47 | */ |
|||||||||||||
48 | public function store(Request $request) |
|||||||||||||
49 | { |
|||||||||||||
50 | $this->validate($request, |
|||||||||||||
51 | [ |
|||||||||||||
52 | 'user' => 'required', |
|||||||||||||
53 | 'message' => 'required|max:10000', |
|||||||||||||
54 | 'subject' => 'required' |
|||||||||||||
55 | ] |
|||||||||||||
56 | ); |
|||||||||||||
57 | $this->inboxService->addConversation($request->get('user'), $request->get('message'), $request->get('subject')); |
|||||||||||||
58 | } |
|||||||||||||
59 | ||||||||||||||
60 | /** |
|||||||||||||
61 | * Display the specified resource. |
|||||||||||||
62 | * |
|||||||||||||
63 | * @param conversation|int $id |
|||||||||||||
64 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
|||||||||||||
0 ignored issues
–
show
The type
Illuminate\View\View was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
||||||||||||||
65 | */ |
|||||||||||||
66 | public function show(Conversation $id) |
|||||||||||||
67 | { |
|||||||||||||
68 | if(auth()->id() == $id->id_to OR auth()->id() == $id->id_from) { |
|||||||||||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Using logical operators such as
or instead of || is generally not recommended.
PHP has two types of connecting operators (logical operators, and boolean operators):
The difference between these is the order in which they are executed. In most cases,
you would want to use a boolean operator like Let’s take a look at a few examples: // Logical operators have lower precedence:
$f = false or true;
// is executed like this:
($f = false) or true;
// Boolean operators have higher precedence:
$f = false || true;
// is executed like this:
$f = (false || true);
Logical Operators are used for Control-FlowOne case where you explicitly want to use logical operators is for control-flow such as this: $x === 5
or die('$x must be 5.');
// Instead of
if ($x !== 5) {
die('$x must be 5.');
}
Since // The following is currently a parse error.
$x === 5
or throw new RuntimeException('$x must be 5.');
These limitations lead to logical operators rarely being of use in current PHP code. ![]() The function
auth was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
||||||||||||||
69 | return view('inbox::inbox.show')->with('conversation', $id); |
|||||||||||||
0 ignored issues
–
show
The function
view was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
||||||||||||||
70 | } |
|||||||||||||
71 | return redirect()->back(); |
|||||||||||||
0 ignored issues
–
show
The function
redirect was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
||||||||||||||
72 | ||||||||||||||
73 | } |
|||||||||||||
74 | ||||||||||||||
75 | /** |
|||||||||||||
76 | * Update the specified resource in storage. |
|||||||||||||
77 | * |
|||||||||||||
78 | * @param \Illuminate\Http\Request $request |
|||||||||||||
79 | * @param conversation|int $id |
|||||||||||||
80 | * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\Response |
|||||||||||||
81 | */ |
|||||||||||||
82 | public function addMessage(Request $request, Conversation $id) |
|||||||||||||
83 | { |
|||||||||||||
84 | $this->validate($request, |
|||||||||||||
85 | [ |
|||||||||||||
86 | 'message' => 'required|max:10000' |
|||||||||||||
87 | ] |
|||||||||||||
88 | ); |
|||||||||||||
89 | if(auth()->id() == $id->id_to OR auth()->id() == $id->id_from) { |
|||||||||||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Using logical operators such as
or instead of || is generally not recommended.
PHP has two types of connecting operators (logical operators, and boolean operators):
The difference between these is the order in which they are executed. In most cases,
you would want to use a boolean operator like Let’s take a look at a few examples: // Logical operators have lower precedence:
$f = false or true;
// is executed like this:
($f = false) or true;
// Boolean operators have higher precedence:
$f = false || true;
// is executed like this:
$f = (false || true);
Logical Operators are used for Control-FlowOne case where you explicitly want to use logical operators is for control-flow such as this: $x === 5
or die('$x must be 5.');
// Instead of
if ($x !== 5) {
die('$x must be 5.');
}
Since // The following is currently a parse error.
$x === 5
or throw new RuntimeException('$x must be 5.');
These limitations lead to logical operators rarely being of use in current PHP code. ![]() The function
auth was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
||||||||||||||
90 | ||||||||||||||
91 | $this->inboxService->addMessage($request, $id); |
|||||||||||||
92 | } |
|||||||||||||
93 | return redirect()->back(); |
|||||||||||||
0 ignored issues
–
show
The function
redirect was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
||||||||||||||
94 | ||||||||||||||
95 | } |
|||||||||||||
96 | /** |
|||||||||||||
97 | * Remove the specified resource from storage. |
|||||||||||||
98 | * |
|||||||||||||
99 | * @param int $id |
|||||||||||||
100 | * @return \Illuminate\Http\Response |
|||||||||||||
101 | */ |
|||||||||||||
102 | public function destroy(Conversation $id) |
|||||||||||||
103 | { |
|||||||||||||
104 | if(auth()->id() == $id->id_to OR auth()->id() == $id->id_from) { |
|||||||||||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Using logical operators such as
or instead of || is generally not recommended.
PHP has two types of connecting operators (logical operators, and boolean operators):
The difference between these is the order in which they are executed. In most cases,
you would want to use a boolean operator like Let’s take a look at a few examples: // Logical operators have lower precedence:
$f = false or true;
// is executed like this:
($f = false) or true;
// Boolean operators have higher precedence:
$f = false || true;
// is executed like this:
$f = (false || true);
Logical Operators are used for Control-FlowOne case where you explicitly want to use logical operators is for control-flow such as this: $x === 5
or die('$x must be 5.');
// Instead of
if ($x !== 5) {
die('$x must be 5.');
}
Since // The following is currently a parse error.
$x === 5
or throw new RuntimeException('$x must be 5.');
These limitations lead to logical operators rarely being of use in current PHP code. ![]() The function
auth was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
||||||||||||||
105 | ||||||||||||||
106 | $this->inboxService->deleteConversation($id); |
|||||||||||||
107 | } |
|||||||||||||
108 | return redirect()->back(); |
|||||||||||||
0 ignored issues
–
show
The function
redirect was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
||||||||||||||
109 | ||||||||||||||
110 | } |
|||||||||||||
111 | } |
|||||||||||||
112 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths