1 | <?php |
||||
2 | |||||
3 | declare(strict_types=1); |
||||
4 | |||||
5 | namespace Uro\TeltonikaFmParser\Model; |
||||
6 | |||||
7 | class SensorsData |
||||
8 | { |
||||
9 | /** |
||||
10 | * @todo: Implement SensorsData |
||||
11 | * |
||||
12 | * @param string $payload |
||||
13 | * |
||||
14 | * @param int $position |
||||
15 | * |
||||
16 | * @return SensorsData |
||||
17 | */ |
||||
18 | public static function createFromHex(string $payload, &$position): SensorsData |
||||
19 | { |
||||
20 | // IO element ID of Event generated -- skip |
||||
21 | $position += 2; |
||||
22 | |||||
23 | $numberOfIoElements = substr($payload, $position, 2); |
||||
0 ignored issues
–
show
Unused Code
introduced
by
![]() |
|||||
24 | $position += 2; |
||||
25 | |||||
26 | $numberOfIo1BitElements = substr($payload, $position, 2); |
||||
27 | $position += 2; |
||||
28 | |||||
29 | $position += 2 * hexdec($numberOfIo1BitElements) + 2 * hexdec($numberOfIo1BitElements); |
||||
30 | |||||
31 | $numberOfIo2BitElements = substr($payload, $position, 2); |
||||
0 ignored issues
–
show
$position of type double is incompatible with the type integer expected by parameter $start of substr() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
32 | $position += 2; |
||||
33 | |||||
34 | $position += 2 * hexdec($numberOfIo2BitElements) + 4 * hexdec($numberOfIo2BitElements); |
||||
35 | |||||
36 | $numberOfIo4BitElements = substr($payload, $position, 2); |
||||
37 | $position += 2; |
||||
38 | |||||
39 | $position += 2 * hexdec($numberOfIo4BitElements) + 8 * hexdec($numberOfIo4BitElements); |
||||
40 | |||||
41 | $numberOfIo8BitElements = substr($payload, $position, 2); |
||||
42 | $position += 2; |
||||
43 | $position += 2 * hexdec($numberOfIo8BitElements) + 16 * hexdec($numberOfIo8BitElements); |
||||
44 | |||||
45 | return new SensorsData(); |
||||
46 | } |
||||
47 | } |
||||
48 |