1111
1212namespace  Symfony \UX \Map \Twig ;
1313
14+ use  Symfony \UX \Map \Circle ;
1415use  Symfony \UX \Map \Map ;
1516use  Symfony \UX \Map \Marker ;
1617use  Symfony \UX \Map \Point ;
1718use  Symfony \UX \Map \Polygon ;
1819use  Symfony \UX \Map \Polyline ;
20+ use  Symfony \UX \Map \Rectangle ;
1921use  Symfony \UX \Map \Renderer \RendererInterface ;
2022use  Twig \Extension \RuntimeExtensionInterface ;
2123
@@ -36,19 +38,23 @@ public function __construct(
3638     * @param array<string, mixed> $markers 
3739     * @param array<string, mixed> $polygons 
3840     * @param array<string, mixed> $polylines 
41+      * @param array<string, mixed> $circles 
42+      * @param array<string, mixed> $rectangles 
3943     */ 
4044    public  function  renderMap (
4145        ?Map $ mapnull ,
4246        array  $ attributes
47+         ?array  $ centernull ,
48+         ?float  $ zoomnull ,
4349        ?array  $ markersnull ,
4450        ?array  $ polygonsnull ,
4551        ?array  $ polylinesnull ,
46-         ?array  $ center null ,
47-         ?float   $ zoom null ,
52+         ?array  $ circles null ,
53+         ?array   $ rectangles null ,
4854    ): string  {
4955        if  ($ mapinstanceof  Map) {
50-             if  (null  !== $ centernull  !== $ zoom$ markers
51-                 throw  new  \InvalidArgumentException ('You cannot set  "center", "markers" or "zoom" on an existing  Map. );
56+             if  (null  !== $ centernull  !== $ zoom$ markers ||  $ polygons  ||  $ polylines  ||  $ circles  ||  $ rectangles 
57+                 throw  new  \InvalidArgumentException ('It is not allowed to pass both a Map object and other parameters (like  "center", "zoom", " markers", etc...) to the "renderMap" method. Please use either a  Map object or the individual parameters . );
5258            }
5359
5460            return  $ this renderer ->renderMap ($ map$ attributes
@@ -64,6 +70,12 @@ public function renderMap(
6470        foreach  ($ polylinesas  $ polyline
6571            $ mapaddPolyline (Polyline::fromArray ($ polyline
6672        }
73+         foreach  ($ circlesas  $ circle
74+             $ mapaddCircle (Circle::fromArray ($ circle
75+         }
76+         foreach  ($ rectanglesas  $ rectangle
77+             $ mapaddRectangle (Rectangle::fromArray ($ rectangle
78+         }
6779        if  (null  !== $ center
6880            $ mapcenter (Point::fromArray ($ center
6981        }
@@ -76,7 +88,7 @@ public function renderMap(
7688
7789    public  function  render (array  $ argsstring 
7890    {
79-         $ maparray_intersect_key ($ args'map '  =>  0 , 'markers '  =>  1 , 'polygons '  =>  2 , 'polylines '  =>  3 , 'center '   =>  4 , 'zoom '   =>  5 ] );
91+         $ maparray_intersect_key ($ argsarray_flip ( ['map ' ,  ' center ' ,  ' zoom ' 'markers ' , 'polygons ' , 'polylines ' , 'circles '  , 'rectangles '  ]) );
8092        $ attributesarray_diff_key ($ args$ map
8193
8294        return  $ this renderMap (...$ map$ attributes
0 commit comments