OpenLayers   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getHtml() 0 20 1
1
<?php
2
3
namespace H4MSK1\Map;
4
5
class OpenLayers extends AbstractMap
6
{
7
    public function getHtml($lat, $lng)
8
    {
9
        $html = <<<EOT
10
        <div id="map" style="height:400px;width:100%;"></div>
11
        <script src="http://www.openlayers.org/api/OpenLayers.js"></script>
12
        <script>
13
          var map = new OpenLayers.Map("map");
14
          map.addLayer(new OpenLayers.Layer.OSM());
15
          var lonLat = new OpenLayers.LonLat($lng, $lat)
16
                .transform(
17
                  new OpenLayers.Projection("EPSG:4326"),
18
                  map.getProjectionObject()
19
                );
20
          var markers = new OpenLayers.Layer.Markers("Markers");
21
          map.addLayer(markers);
22
          markers.addMarker(new OpenLayers.Marker(lonLat));
23
          map.setCenter(lonLat, 14);
24
        </script>
25
EOT;
26
        return $html;
27
    }
28
}
29