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.

GSV::getSentenceTotalNumber()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 1
cts 1
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace BultonFr\NMEA\Frames;
4
5
/**
6
 * Define the parser system for GSV frame type
7
 * 
8
 * @package BultonFr\NMEA
9
 * @author Vermeulen Maxime <[email protected]>
10
 * @link http://www.gpsinformation.org/dale/nmea.htm#GSV
11
 * @link http://aprs.gids.nl/nmea/#gsv
12
 */
13
class GSV extends \BultonFr\NMEA\Frame
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    protected $frameType = 'GSV';
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    protected $frameRegex = '/^'
24
        .'([A-Z]{2}[A-Z]{3}),' //Equipment and trame type
25
        .'(\d*),' //Number of sentences for full data
26
        .'(\d*),' //Sentence number
27
        .'(\d*)' //Number of satellites in view
28
        .'(,(\d*),(\d*),(\d*),(\d*)' //Infos about first satellite
29
        .'(,(\d*),(\d*),(\d*),(\d*)' //Infos about second satellite
30
        .'(,(\d*),(\d*),(\d*),(\d*)' //Infos about trird satellite
31
        .'(,(\d*),(\d*),(\d*),(\d*)' //Infos about fourth satellite
32
        .')?)?)?)?'
33
        .'$/m';
34
    
35
    /**
36
     * @var int $sentenceTotalNumber Number of sentences for full data
37
     */
38
    protected $sentenceTotalNumber;
39
    
40
    /**
41
     * @var int $sentenceCurrentNumber Sentence number
42
     */
43
    protected $sentenceCurrentNumber;
44
    
45
    /**
46
     * @var int $satellitesNumber Number of satellites in view
47
     */
48
    protected $satellitesNumber;
49
50
    /**
51
     * @var \stdClass[] $satellitesInfos Infos about satellites
52
     * Array of object; Object contains properties :
53
     * * prnNumber
54
     * * elevation in degrees. max 90
55
     * * azimuth, degrees from tue north. 0 to 359
56
     * * SNR. 0 to 99dB
57
     */
58
    protected $satellitesInfos;
59
    
60
    /**
61
     * Getter to property sentenceTotalNumber
62
     * 
63
     * @return int
64
     */
65
    public function getSentenceTotalNumber()
66
    {
67 1
        return $this->sentenceTotalNumber;
68
    }
69
70
    /**
71
     * Getter to property sentenceCurrentNumber
72
     * 
73
     * @return int
74
     */
75
    public function getSentenceCurrentNumber()
76
    {
77 1
        return $this->sentenceCurrentNumber;
78
    }
79
80
    /**
81
     * Getter to property satellitesNumber
82
     * 
83
     * @return int
84
     */
85
    public function getSatellitesNumber()
86
    {
87 1
        return $this->satellitesNumber;
88
    }
89
90
    /**
91
     * Getter to property satelliteInfos
92
     * 
93
     * @return \stdClass[]
94
     */
95
    public function getSatellitesInfos()
96
    {
97 1
        return $this->satellitesInfos;
98
    }
99
100
    /**
101
     * {@inheritdoc}
102
     */
103
    protected function decodeFrame($msgParts)
104
    {
105 1
        $this->sentenceTotalNumber   = (int) $msgParts[2];
106 1
        $this->sentenceCurrentNumber = (int) $msgParts[3];
107 1
        $this->satellitesNumber      = (int) $msgParts[4];
108
        
109 1
        for ($svIndex = 0; $svIndex <= 3; $svIndex++) {
110 1
            $this->satellitesInfos[$svIndex] = (object) [
111 1
                'prnNumber' => 0,
112
                'elevation' => 0,
113
                'azimuth'   => 0,
114
                'SNR'       => 0,
115
            ];
116
            
117 1
            $indexPos = 5 * $svIndex;
118 1
            if (!isset($msgParts[(6 + $indexPos)])) {
119 1
                continue;
120
            }
121
            
122 1
            $svInfos            = &$this->satellitesInfos[$svIndex];
123 1
            $svInfos->prnNumber = (int) $msgParts[(6 + $indexPos)];
124 1
            $svInfos->elevation = (int) $msgParts[(7 + $indexPos)];
125 1
            $svInfos->azimuth   = (int) $msgParts[(8 + $indexPos)];
126 1
            $svInfos->SNR       = (int) $msgParts[(9 + $indexPos)];
127
        }
128 1
    }
129
}
130