| Conditions | 3 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 40 | 6 | public function encode() |
|
| 41 | { |
||
| 42 | 6 | $data = Json::encode($this->data, LeafLet::JSON_OPTIONS); |
|
| 43 | 6 | $options = $this->getOptions(); |
|
| 44 | 6 | $name = $this->name; |
|
| 45 | 6 | $map = $this->map; |
|
| 46 | 6 | $js = "L.geoJson($data, $options)" . ($map !== null ? ".addTo($map)" : "") . ";"; |
|
| 47 | 6 | if (!empty($name)) { |
|
| 48 | 3 | $js = "var $name = $js"; |
|
| 49 | 3 | } |
|
| 50 | |||
| 51 | 6 | return new JsExpression($js); |
|
| 52 | } |
||
| 53 | |||
| 55 |