Zoom   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 20
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A encode() 0 12 4
1
<?php
2
/**
3
 * @copyright Copyright (c) 2013-2015 2amigOS! Consulting Group LLC
4
 * @link http://2amigos.us
5
 * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
6
 */
7
8
namespace dosamigos\leaflet\controls;
9
10
use yii\web\JsExpression;
11
12
/**
13
 * Zoom renders basic zoom control with two buttons (zoom in and zoom out). It is put on the map by default unless you
14
 * set the map's zoomControl option to false
15
 *
16
 * @see http://leafletjs.com/reference.html#control-zoom
17
 * @author Antonio Ramirez <[email protected]>
18
 * @link http://www.ramirezcobos.com/
19
 * @link http://www.2amigos.us/
20
 * @package dosamigos\leaflet\controls
21
 */
22
class Zoom extends Control
23
{
24
    /**
25
     * Returns the javascript ready code for the object to render
26
     * @return \yii\web\JsExpression
27
     */
28 9
    public function encode()
29
    {
30 9
        $this->clientOptions['position'] = $this->position;
31 9
        $options = $this->getOptions();
32 9
        $name = $this->getName();
33 9
        $map = $this->map;
34 9
        $js = "L.control.zoom($options)" . ($map !== null ? ".addTo($map);" : "");
35 9
        if (!empty($name)) {
36 3
            $js = "var $name = $js" . ($map !== null ? "" : ";");
37 3
        }
38 9
        return new JsExpression($js);
39
    }
40
41
}
42