MapGenerator   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 22
ccs 8
cts 8
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A MakeLink() 0 11 1
1
<?php
2
3
namespace EVB\Weather;
4
5
/**
6
 * Class for generating a link for an embedded OpenStreetMap map.
7
 */
8
class MapGenerator
9
{
10
    /**
11
     * Generates an OpenStreetMap embedding link with
12
     * it's view more or less centered around a given
13
     * point.
14
     *
15
     * @param float $latitude
16
     * @param float $longitude
17
     * @return string
18
     */
19 1
    public function MakeLink(float $latitude, float $longitude) : string
20
    {
21 1
        $lat1 = $latitude - 1.5;
22 1
        $lat2 = $latitude + 1.5;
23 1
        $long1 = $longitude - 4;
24 1
        $long2 = $longitude + 4;
25
26 1
        $link = "https://www.openstreetmap.org/export/embed.html?bbox=${long1}%2C${lat1}%2C${long2}%2C${lat2}"
27 1
        . "&amp;layer=mapnik&amp;marker=${latitude}%2C${longitude}";
28
29 1
        return $link;
30
    }
31
}
32