CircleMarker   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
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\layers;
9
10
11
use yii\web\JsExpression;
12
13
/**
14
 * CircleMarker is a circle of a fixed size with radius specified in pixels. Setting its radius wont change its size.
15
 *
16
 * @see http://leafletjs.com/reference.html#circlemarker
17
 * @author Antonio Ramirez <[email protected]>
18
 * @link http://www.ramirezcobos.com/
19
 * @link http://www.2amigos.us/
20
 * @package dosamigos\leaflet\layers
21
 */
22
/**
23
 * @property string $name
24
 */
25
class CircleMarker extends Circle
26
{
27
    /**
28
     * Returns the javascript ready code for the object to render
29
     * @return JsExpression
30
     */
31 9
    public function encode()
32
    {
33 9
        $bounds = $this->getLatLng()->toArray(true);
34 9
        $options = $this->getOptions();
35 9
        $name = $this->name;
36 9
        $map = $this->map;
37 9
        $js = $this->bindPopupContent("L.circleMarker($bounds, $options)") . ($map !== null ? ".addTo($map);" : "");
38 9
        if (!empty($name)) {
39 3
            $js = "var $name = $js" . ($map !== null ? "" : ";");
40 3
        }
41 9
        return new JsExpression($js);
42
    }
43
44
}
45