• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

brick / geo / 13846298605

13 Mar 2025 11:05PM UTC coverage: 51.017% (+0.03%) from 50.992%
13846298605

push

github

BenMorel
Replace if/else with match

5 of 5 new or added lines in 1 file covered. (100.0%)

233 existing lines in 7 files now uncovered.

1856 of 3638 relevant lines covered (51.02%)

1141.32 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
/src/Projector/SwapXYProjector.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Brick\Geo\Projector;
6

7
use Brick\Geo\CoordinateSystem;
8
use Brick\Geo\Point;
9
use Override;
10

11
/**
12
 * Swaps the X and Y coordinates of a Geometry, while keeping the same SRID.
13
 */
14
final class SwapXYProjector implements Projector
15
{
16
    #[Override]
17
    public function project(Point $point): Point
18
    {
UNCOV
19
        if ($point->isEmpty()) {
14✔
20
            return $point;
×
21
        }
22

UNCOV
23
        $coordinates = $point->toArray();
14✔
24

25
        /** @psalm-suppress PossiblyUndefinedArrayOffset */
UNCOV
26
        [$x, $y] = $coordinates;
14✔
27

UNCOV
28
        $coordinates[0] = $y;
14✔
UNCOV
29
        $coordinates[1] = $x;
14✔
30

UNCOV
31
        return new Point($point->coordinateSystem(), ...$coordinates);
14✔
32
    }
33

34
    #[Override]
35
    public function getTargetCoordinateSystem(CoordinateSystem $sourceCoordinateSystem): CoordinateSystem
36
    {
37
        return $sourceCoordinateSystem;
×
38
    }
39
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc