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