GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (4)

src/Model/Data.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Uro\TeltonikaFmParser\Model;
6
7
use DateTimeImmutable;
8
use JsonSerializable;
9
10
class Data implements Model, JsonSerializable
11
{
12
    /**
13
     * @var DateTimeImmutable
14
     */
15
    private $dateTime;
16
17
    /**
18
     * @var int
19
     */
20
    private $priority;
21
22
    /**
23
     * @var GpsData
24
     */
25
    private $gpsData;
26
27
    /**
28
     * @var SensorsData
29
     */
30
    private $sensorsData;
31
32
    public function __construct(
33
        DateTimeImmutable $dateTime,
34
        GpsData $gpsData,
35
        SensorsData $sensorsData,
36
        int $priority
37
    )
38
    {
39
        $this->dateTime = $dateTime;
40
        $this->priority = $priority;
41
        $this->gpsData = $gpsData;
42
        $this->sensorsData = $sensorsData;
43
    }
44
45
    public function getDateTime(): DateTimeImmutable
46
    {
47
        return $this->dateTime;
48
    }
49
50
    public function getPriority(): int
51
    {
52
        return $this->priority;
53
    }
54
55
    public function getGpsData(): GpsData
56
    {
57
        return $this->gpsData;
58
    }
59
60
    public function getSensorsData(): SensorsData
61
    {
62
        return $this->sensorsData;
63
    }
64
65
    public function jsonSerialize(): array
66
    {
67
        return [
68
            'dateTime' => $this->getDateTime(),
69
            'priority' => $this->getPriority(),
70
            'gpsData' => $this->getGpsData()
71
        ];
72
    }
73
74
    public static function createFromHex(string $payload, int &$position): Data
75
    {
76
        $timestamp = hexdec(substr($payload, $position, 16)) / 1000;
77
78
        $dateTime = new DateTimeImmutable();
79
        $dateTime = $dateTime->setTimestamp(intval($timestamp)); // Timestamp needs to be a float because its containing milliseconds
80
81
        $position += 16;
82
83
        $priority = (int)hexdec(substr($payload, $position, 2));
84
        $position += 2;
85
86
        $gpsData = GpsData::createFromHex($payload, $position);
87
88
        $sensorsData = SensorsData::createFromHex($payload, $position);
89
90
        return new Data($dateTime, $gpsData, $sensorsData, $priority);
0 ignored issues
show
It seems like $dateTime can also be of type false; however, parameter $dateTime of Uro\TeltonikaFmParser\Model\Data::__construct() does only seem to accept DateTimeImmutable, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

90
        return new Data(/** @scrutinizer ignore-type */ $dateTime, $gpsData, $sensorsData, $priority);
Loading history...
91
    }
92
}
93