Conditions | 2 |
Paths | 2 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | public function getData(Action $action) |
||
|
|||
13 | { |
||
14 | $varService = $this->getContainer()->get('vars'); |
||
15 | |||
16 | $fp = file_get_contents("http://192.168.0.221/data.json"); |
||
17 | |||
18 | if (!$fp) { |
||
19 | return 'Couldn\'t connect to sensor'; |
||
20 | } |
||
21 | |||
22 | $this->getContainer()->get('logger')->addInfo('Got sensor data: '.$fp); |
||
23 | $fp = json_decode($fp, true); |
||
24 | |||
25 | $varService->set('outside.temperature', $fp['data']['temperature']); |
||
26 | $varService->set('moisture.raw', $fp['data']['rowmoisture']); |
||
27 | $varService->set('moisture.combined', $fp['data']['moisture']); |
||
28 | |||
29 | return 'Info recorded successfully'; |
||
30 | } |
||
31 | } |
||
32 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.