Conditions | 4 |
Paths | 4 |
Total Lines | 23 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
30 | public function run(Request $request) { |
||
31 | $body = Json::decode($request->getContent()); |
||
1 ignored issue
–
show
|
|||
32 | if (!isset($body['data'])) { |
||
33 | throw new InvalidParameterException(); |
||
34 | } |
||
35 | $data = $body['data']; |
||
36 | |||
37 | if (!isset($data['id'])) { |
||
38 | throw new InvalidParameterException(); |
||
39 | } |
||
40 | |||
41 | $id = $this->getParam('id'); |
||
42 | $activity = ActivityQuery::create()->findOneById($id); |
||
43 | $activity->setUserId($data['id']); |
||
44 | |||
45 | // validate |
||
46 | if (!$activity->validate()) { |
||
47 | throw new ValidationException($activity->getValidationFailures()); |
||
48 | } else { |
||
49 | $activity->save(); |
||
50 | return $this->response->run($request, $activity); |
||
51 | } |
||
52 | } |
||
53 | } |
||
54 |
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.