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.

VTG::getSpeedKmH()   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 VTG frame type
7
 * 
8
 * @package BultonFr\NMEA
9
 * @author Vermeulen Maxime <[email protected]>
10
 * @link http://www.gpsinformation.org/dale/nmea.htm#VTG
11
 * @link http://aprs.gids.nl/nmea/#vtg
12
 */
13
class VTG extends \BultonFr\NMEA\Frame
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    protected $frameType = 'VTG';
19
20
    /**
21
     * Format: $--VTG,x.x,T,x.x,M,x.x,N,x.x,K
22
     * {@inheritdoc}
23
     */
24
    protected $frameRegex = '/^'
25
        .'([A-Z]{2}[A-Z]{3}),' //Equipment and trame type
26
        .'([0-9\.]*),T,' //True track made good (degrees)
27
        .'([0-9\.]*),M,' //Magnetic track made good
28
        .'([0-9\.]*),N,' //Ground speed, knots
29
        .'([0-9\.]*),K' //Ground speed, Kilometers per hour
30
        .'(,(A|D|E|N|S)?)?' //Mode indicator (NMEA >= 2.3)
31
        .'$/m';
32
    
33
    /**
34
     * @var float $trueTrack True track made good (degrees)
35
     */
36
    protected $trueTrack;
37
    
38
    /**
39
     * @var float $magneticTrack Magnetic track made good
40
     */
41
    protected $magneticTrack;
42
    
43
    /**
44
     * @var float $speedKnots Ground speed, knots
45
     */
46
    protected $speedKnots;
47
    
48
    /**
49
     * @var float $speedKmH Ground speed, Kilometers per hour
50
     */
51
    protected $speedKmH;
52
    
53
    /**
54
     * @var string $mode Mode indicator (NMEA >= 2.3)
55
     * * A : autonomous
56
     * * D : differential
57
     * * E : Estimated
58
     * * N : not valid
59
     * * S : Simulator
60
     */
61
    protected $mode;
62
    
63
    /**
64
     * Getter to property trueTrack
65
     * 
66
     * @return float
67
     */
68
    public function getTrueTrack()
69
    {
70 1
        return $this->trueTrack;
71
    }
72
73
    /**
74
     * Getter to property magneticTrack
75
     * 
76
     * @return float
77
     */
78
    public function getMagneticTrack()
79
    {
80 1
        return $this->magneticTrack;
81
    }
82
83
    /**
84
     * Getter to property speedKnots
85
     * 
86
     * @return float
87
     */
88
    public function getSpeedKnots()
89
    {
90 1
        return $this->speedKnots;
91
    }
92
93
    /**
94
     * Getter to property speedKmH
95
     * 
96
     * @return float
97
     */
98
    public function getSpeedKmH()
99
    {
100 1
        return $this->speedKmH;
101
    }
102
103
    /**
104
     * Getter to property mode
105
     * 
106
     * @return string
107
     */
108
    public function getMode()
109
    {
110 1
        return $this->mode;
111
    }
112
113
    /**
114
     * {@inheritdoc}
115
     */
116
    protected function decodeFrame($msgParts)
117
    {
118 1
        $this->trueTrack     = (float) $msgParts[2];
119 1
        $this->magneticTrack = (float) $msgParts[3];
120 1
        $this->speedKnots    = (float) $msgParts[4];
121 1
        $this->speedKmH      = (float) $msgParts[5];
122
        
123 1
        if (isset($msgParts[7])) {
124 1
            $this->mode = (string) $msgParts[7];
125
        }
126
        
127 1
    }
128
}
129