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 (11)

src/utils/Coordinates.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace BultonFr\NMEA\Utils;
4
5
/**
6
 * Tools to convert NMEA coordinates
7
 * 
8
 * @package BultonFr\NMEA
9
 * @author Vermeulen Maxime <[email protected]>
10
 */
11
class Coordinates
12
{
13
    /**
14
     * Convert coordinate to degree format
15
     * 
16
     * @param string $data Data readed by parser
17
     * @param string $direction (default null) Direction of the coordinate
18
     * @param string $isLongitude (default false) If is for longitude
19
     * @param boolean $toString (default false) Return format
20
     * 
21
     * @return \stdClass|string Change with $toString parameter value
22
     */
23
    public static function convertGPSDataToDegree(
24
        $data,
25
        $direction = null,
26
        $isLongitude = false,
27
        $toString = false
28
    ) {
29 1
        $dotPosition  = strpos($data, '.');
30 1
        $degreeEndPos = ($isLongitude === false) ? 2 : 3;
31
        
32
        $obj = (object) [
33 1
            'degree' => (int) substr($data, 0, $degreeEndPos),
34 1
            'minute' => (int) substr($data, $degreeEndPos, $dotPosition),
35 1
            'second' => (int) substr($data, $dotPosition+1)
36
        ];
37
        
38 1
        if ($toString === false) {
39 1
            return $obj;
40
        }
41
        
42 1
        return $obj->degree.'° '.$obj->minute.'\' '.$obj->second.'" '.$direction;
43
    }
44
    
45
    /**
46
     * Convert coordinate to decimal format
47
     * 
48
     * @param string $data Data readed by parser
49
     * @param string $isLongitude (default false) If is for longitude
50
     * 
51
     * @return float
52
     */
53
    public static function convertGPSDataToDec($data, $isLongitude = false)
54
    {
55 1
        $obj = static::convertGPSDataToDegree($data, null, $isLongitude);
0 ignored issues
show
It seems like $isLongitude can also be of type false; however, parameter $isLongitude of BultonFr\NMEA\Utils\Coor...onvertGPSDataToDegree() does only seem to accept string, 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

55
        $obj = static::convertGPSDataToDegree($data, null, /** @scrutinizer ignore-type */ $isLongitude);
Loading history...
56
        
57
        /**
58
         * DD = d + (min/60) + (sec/3600)
59
         * @link http://www.latlong.net/degrees-minutes-seconds-to-decimal-degrees
60
         */
61 1
        return ($obj->degree) + ($obj->minute / 60) + ($obj->second / 3600);
62
    }
63
}
64