Completed
Push — master ( ed2425...d8adec )
by Daryl
01:55
created

Map_View::_make_marker_args()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
namespace Clubdeuce\WPLib\Components\GoogleMaps;
4
5
/**
6
 * Class Map_View
7
 * @package  Clubdeuce\GoogleMaps
8
 * @property Map $item
9
 */
10
class Map_View extends \WPLib_View_Base {
11
12
    function the_map() {
13
14
        wp_localize_script( 'map-control', 'objMapParams',  $this->item->make_args() );
15
        wp_localize_script( 'map-control', 'objMapMarkers', $this->_make_markers_args() );
16
17
        echo '<div id="map" class="google-map" style="height: 400px; width: 100%"></div>';
18
19
    }
20
21
    /**
22
     * @return array
23
     */
24
    private function _make_markers_args() {
25
26
        /**
27
         * @var Marker $marker
28
         */
29
        return array_map( function( $marker ) {
30
            return $marker->make_options();
31
        }, $this->item->markers() );
32
33
    }
34
35
}
36