Skip to content

Commit 7f48247

Browse files
committed
[Map] Minor adjustements
1 parent a27bd08 commit 7f48247

File tree

7 files changed

+19
-7
lines changed

7 files changed

+19
-7
lines changed

src/Map/CHANGELOG.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
- Add `DistanceCalculatorInterface` interface and three implementations:
88
`HaversineDistanceCalculator`, `SphericalCosineDistanceCalculator` and `VincentyDistanceCalculator`.
99
- Add `CoordinateUtils` helper, to convert decimal coordinates (`43.2109`) in DMS (`56° 78' 90"`)
10-
11-
- Add property `$id` to `Marker`, `Polygon` and `Polyline` constructors
10+
- Add parameter `id` to `Marker`, `Polygon` and `Polyline` constructors
1211
- Add method `Map::removeMarker(string|Marker $markerOrId)`
1312
- Add method `Map::removePolygon(string|Polygon $polygonOrId)`
1413
- Add method `Map::removePolyline(string|Polyline $polylineOrId)`

src/Map/src/Element.php

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111

1212
namespace Symfony\UX\Map;
1313

14+
/**
15+
* @author Sylvain Blondeau <[email protected]>
16+
*
17+
* @internal
18+
*/
1419
interface Element
1520
{
1621
}

src/Map/src/Elements.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
* Represents a collection of map elements.
1616
*
1717
* @author Sylvain Blondeau <[email protected]>
18+
*
19+
* @internal
1820
*/
1921
abstract class Elements
2022
{
21-
protected \SplObjectStorage $elements;
23+
private \SplObjectStorage $elements;
2224

2325
public function __construct(
2426
array $elements,
@@ -29,7 +31,7 @@ public function __construct(
2931
}
3032
}
3133

32-
public function add(Element $element): self
34+
public function add(Element $element): static
3335
{
3436
$this->elements->attach($element, $element->id ?? $this->elements->getHash($element));
3537

@@ -47,7 +49,7 @@ private function getElement(string $id): ?Element
4749
return null;
4850
}
4951

50-
public function remove(Element|string $elementOrId): self
52+
public function remove(Element|string $elementOrId): static
5153
{
5254
if (\is_string($elementOrId)) {
5355
$elementOrId = $this->getElement($elementOrId);

src/Map/src/Map.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ final class Map
2626

2727
/**
2828
* @param Marker[] $markers
29+
* @param Polygon[] $polygons
2930
* @param Polyline[] $polylines
30-
* @param Polygone[] $polygons
3131
*/
3232
public function __construct(
3333
private readonly ?string $rendererName = null,
@@ -40,8 +40,8 @@ public function __construct(
4040
array $polylines = [],
4141
) {
4242
$this->markers = new Markers($markers);
43-
$this->polylines = new Polylines($polylines);
4443
$this->polygons = new Polygons($polygons);
44+
$this->polylines = new Polylines($polylines);
4545
}
4646

4747
public function getRendererName(): ?string

src/Map/src/Markers.php

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* Represents a Marker collection.
1616
*
1717
* @author Sylvain Blondeau <[email protected]>
18+
*
19+
* @internal
1820
*/
1921
final class Markers extends Elements
2022
{

src/Map/src/Polygons.php

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* Represents a Polygon collection.
1616
*
1717
* @author Sylvain Blondeau <[email protected]>
18+
*
19+
* @internal
1820
*/
1921
final class Polygons extends Elements
2022
{

src/Map/src/Polylines.php

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* Represents a Polyline collection.
1616
*
1717
* @author Sylvain Blondeau <[email protected]>
18+
*
19+
* @internal
1820
*/
1921
final class Polylines extends Elements
2022
{

0 commit comments

Comments
 (0)