Map::getMap()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 27
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 27
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Chai17\Models;
4
5
class Map
6
{
7
8 2
    public function getMap($latitude, $longitude)
9
    {
10
        $mapDiv = "
11
            <div id='mapdiv'></div>
12
            <script src='http://www.openlayers.org/api/OpenLayers.js'></script>
13
            <script>
14
              map = new OpenLayers.Map('mapdiv');
15
              map.addLayer(new OpenLayers.Layer.OSM());
16
17 2
              var lonLat = new OpenLayers.LonLat( $longitude , $latitude )
18
                    .transform(
19
                      new OpenLayers.Projection('EPSG:4326'), // transform from WGS 1984
20
                      map.getProjectionObject() // to Spherical Mercator Projection
21
                    );
22
23
              var zoom=15;
24
25
              var markers = new OpenLayers.Layer.Markers( 'Markers' );
26
              map.addLayer(markers);
27
28
              markers.addMarker(new OpenLayers.Marker(lonLat));
29
30
              map.setCenter (lonLat, zoom);
31
            </script>
32
        ";
33
34 2
        return $mapDiv;
35
    }
36
}
37