public function addTo(Map $map)
    {
        $this->map = $map;
        $map->addLayer($this);

        return $this->addMethod('addTo', array($map));
    }
public function addTo(Map $map)
    {
        $this->map = $map;
        $map->addLayer($this);

        return $this->addMethod('addTo', array($map));
    }
public function addTo ( Map $ map ) { $ this -> map = $ map ; $ map -> addLayer ( $ this ) ; return $ this -> addMethod ( 'addTo' , array ( $ map ) ) ; }
Add layer to the map.

Instead create an addTo method, it's assigned to the map.
This is required so that the encoder knows the relation between the map and the layer.

@param Map $map The leaflet map.

@return $this
Add layer to the map .