This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | |||
4 | require_once("vendor/autoload.php"); |
||
5 | |||
6 | |||
7 | use App\Lib\DsManager\Helpers\MatchSimulator; |
||
8 | use App\Lib\DsManager\Models\Orm\League; |
||
9 | use App\Lib\DsManager\Models\Orm\LeagueRound; |
||
10 | use App\Lib\DsManager\Models\Orm\Match; |
||
11 | use App\Lib\DsManager\Models\Orm\MatchResult; |
||
12 | use \App\Lib\Helpers\Responder; |
||
13 | use \App\Lib\DsManager\Models\Orm\Player; |
||
14 | use \App\Lib\DsManager\Models\Orm\Team; |
||
15 | use \App\Lib\DsManager\Models\Orm\Coach; |
||
16 | |||
17 | $configuration = [ |
||
18 | 'settings' => [ |
||
19 | 'displayErrorDetails' => true, |
||
20 | ], |
||
21 | ]; |
||
22 | $c = new \Slim\Container($configuration); |
||
23 | $api = new \Slim\App($c); |
||
24 | |||
25 | $api->get('/ping', function ($request, $response, $args) { |
||
0 ignored issues
–
show
|
|||
26 | $jsonResp = json_encode( |
||
27 | [ |
||
28 | "status" => "service up", |
||
29 | "message" => "in a bottle" |
||
30 | ] |
||
31 | ); |
||
32 | return Responder::getJsonResponse($jsonResp, $response); |
||
33 | }); |
||
34 | |||
35 | $api->get('/statistics', function ($request, $response, $args) { |
||
0 ignored issues
–
show
|
|||
36 | return Responder::getJsonResponse( |
||
37 | json_encode([ |
||
38 | 'players' => Player::getBest(), |
||
39 | 'teams' => Team::getBest() |
||
40 | ],JSON_NUMERIC_CHECK), |
||
41 | $response |
||
42 | ); |
||
43 | }); |
||
44 | |||
45 | $api->get('/coaches', function ($request, $response, $args) { |
||
0 ignored issues
–
show
|
|||
46 | return Responder::getJsonResponse( |
||
47 | Coach::all(), |
||
48 | $response |
||
49 | ); |
||
50 | }); |
||
51 | |||
52 | $api->get('/teams', function ($request, $response, $args) { |
||
0 ignored issues
–
show
|
|||
53 | return Responder::getJsonResponse( |
||
54 | Team::all(), |
||
55 | $response |
||
56 | ); |
||
57 | }); |
||
58 | |||
59 | $api->get('/teams/{id}', function ($request, $response, $args) { |
||
60 | return Responder::getJsonResponse( |
||
61 | Team::complete() |
||
0 ignored issues
–
show
The method
complete() does not exist on App\Lib\DsManager\Models\Orm\Team . Did you maybe mean scopeComplete() ?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. ![]() |
|||
62 | ->where( |
||
63 | [ |
||
64 | 'id' => $args['id'] |
||
65 | ] |
||
66 | )->get(), |
||
67 | $response |
||
68 | ); |
||
69 | }); |
||
70 | |||
71 | View Code Duplication | $api->get('/teams/{id}/players', function ($request, $response, $args) { |
|
72 | return Responder::getJsonResponse( |
||
73 | Team::with( |
||
74 | 'roster' |
||
75 | )->where( |
||
76 | [ |
||
77 | 'id' => $args['id'] |
||
78 | ] |
||
79 | )->get(), |
||
80 | $response |
||
81 | ); |
||
82 | }); |
||
83 | |||
84 | $api->get('/teams/{id}/players/{playerId}', function ($request, $response, $args) { |
||
85 | return Responder::getJsonResponse( |
||
86 | Player::statistics()->where( |
||
87 | [ |
||
88 | 'id' => $args['playerId'], |
||
89 | 'team_id' => $args['id'] |
||
90 | ] |
||
91 | )->get(), |
||
92 | $response |
||
93 | ); |
||
94 | }); |
||
95 | |||
96 | View Code Duplication | $api->get('/teams/{id}/coach', function ($request, $response, $args) { |
|
97 | return Responder::getJsonResponse( |
||
98 | Team::with( |
||
99 | 'coach' |
||
100 | )->where( |
||
101 | [ |
||
102 | 'id' => $args['id'] |
||
103 | ] |
||
104 | )->get(), |
||
105 | $response |
||
106 | ); |
||
107 | }); |
||
108 | |||
109 | $api->get('/leagues', function ($request, $response, $args) { |
||
0 ignored issues
–
show
|
|||
110 | return Responder::getJsonResponse( |
||
111 | League::all(), |
||
112 | $response |
||
113 | ); |
||
114 | }); |
||
115 | |||
116 | $api->get('/leagues/{id}', function ($request, $response, $args) { |
||
117 | return Responder::getJsonResponse( |
||
118 | League::with('rounds') |
||
0 ignored issues
–
show
The method
where does only exist in Illuminate\Database\Eloquent\Builder , but not in Illuminate\Database\Eloquent\Model .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
119 | ->where( |
||
120 | [ |
||
121 | 'id' => $args['id'] |
||
122 | ] |
||
123 | )->first(), |
||
124 | $response |
||
125 | ); |
||
126 | }); |
||
127 | |||
128 | $api->get('/leagues/{id}/rounds/{roundId}', function ($request, $response, $args) { |
||
129 | return Responder::getJsonResponse( |
||
130 | LeagueRound::complete() |
||
0 ignored issues
–
show
The method
complete() does not exist on App\Lib\DsManager\Models\Orm\LeagueRound . Did you maybe mean scopeComplete() ?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. ![]() |
|||
131 | ->where( |
||
132 | [ |
||
133 | 'id' => $args['roundId'], |
||
134 | ] |
||
135 | )->first(), |
||
136 | $response |
||
137 | ); |
||
138 | }); |
||
139 | |||
140 | $api->put('/leagues/{id}/rounds/{roundId}/simulate', function ($request, $response, $args) { |
||
141 | return Responder::getJsonResponse( |
||
142 | MatchSimulator::simulateRound( |
||
143 | $args['roundId'] |
||
144 | ), |
||
145 | $response |
||
146 | ); |
||
147 | }); |
||
148 | |||
149 | $api->get('/matches', function ($request, $response, $args) { |
||
0 ignored issues
–
show
|
|||
150 | return Responder::getJsonResponse( |
||
151 | Match::teams()->get(), |
||
152 | $response |
||
153 | ); |
||
154 | }); |
||
155 | |||
156 | $api->post('/matches', function ($request, $response, $args) { |
||
0 ignored issues
–
show
|
|||
157 | $json = $request->getBody(); |
||
158 | $json = json_decode($json, true); |
||
159 | return Responder::getJsonResponse( |
||
160 | Match::create( |
||
161 | $json |
||
162 | ), |
||
163 | $response |
||
164 | ); |
||
165 | }); |
||
166 | |||
167 | $api->get('/matches/{id}', function ($request, $response, $args) { |
||
168 | return Responder::getJsonResponse( |
||
169 | Match::complete() |
||
0 ignored issues
–
show
The method
complete() does not exist on App\Lib\DsManager\Models\Orm\Match . Did you maybe mean scopeComplete() ?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. ![]() |
|||
170 | ->where( |
||
171 | [ |
||
172 | 'id' => $args['id'] |
||
173 | ] |
||
174 | )->first(), |
||
175 | $response |
||
176 | ); |
||
177 | }); |
||
178 | |||
179 | $api->get('/matches/{id}/result', function ($request, $response, $args) { |
||
180 | $result = MatchResult::complete() |
||
181 | ->where( |
||
182 | [ |
||
183 | 'id' => $args['id'] |
||
184 | ] |
||
185 | )->first(); |
||
186 | |||
187 | return Responder::getJsonResponse( |
||
188 | $result, |
||
189 | $response |
||
190 | ); |
||
191 | }); |
||
192 | |||
193 | $api->put('/matches/{id}/simulate', function ($request, $response, $args) { |
||
194 | return Responder::getJsonResponse( |
||
195 | MatchSimulator::simulateCompleteResult( |
||
196 | $args['id'] |
||
197 | ), |
||
198 | $response |
||
199 | ); |
||
200 | }); |
||
201 | $api->run(); |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.