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

Map_View   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 26
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A the_map() 0 8 1
A _make_markers_args() 0 10 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