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

brick / geo / 13715719367

06 Mar 2025 02:18PM UTC coverage: 84.117%. First build
13715719367

push

github

BenMorel
Public properties

71 of 77 new or added lines in 23 files covered. (92.21%)

1557 of 1851 relevant lines covered (84.12%)

1887.21 hits per line

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

0.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
    {
19
        if ($point->isEmpty()) {
×
20
            return $point;
×
21
        }
22

23
        $coordinates = $point->toArray();
×
24

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

28
        $coordinates[0] = $y;
×
29
        $coordinates[1] = $x;
×
30

NEW
31
        return new Point($point->coordinateSystem, ...$coordinates);
×
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