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

brick / geo / 17334945423

29 Aug 2025 09:48PM UTC coverage: 50.432%. First build
17334945423

push

github

BenMorel
Apply ECS

203 of 232 new or added lines in 29 files covered. (87.5%)

1867 of 3702 relevant lines covered (50.43%)

1140.21 hits per line

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

46.67
/src/Triangle.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Brick\Geo;
6

7
use Brick\Geo\Attribute\NoProxy;
8
use Brick\Geo\Exception\InvalidGeometryException;
9
use Brick\Geo\Projector\Projector;
10
use Override;
11

12
use function array_map;
13

14
/**
15
 * A Triangle is a Polygon with 3 distinct, non-collinear vertices and no interior boundary.
16
 *
17
 * @final
18
 */
19
class Triangle extends Polygon
20
{
21
    #[NoProxy, Override]
22
    public function geometryType(): string
23
    {
24
        return 'Triangle';
680✔
25
    }
26

27
    #[NoProxy, Override]
28
    public function geometryTypeBinary(): int
29
    {
30
        return Geometry::TRIANGLE;
576✔
31
    }
32

33
    #[Override]
34
    public function project(Projector $projector): Triangle
35
    {
36
        return new Triangle(
×
37
            $projector->getTargetCoordinateSystem($this->coordinateSystem),
×
38
            ...array_map(
×
39
                fn (LineString $ring) => $ring->project($projector),
×
40
                $this->rings,
×
41
            ),
×
42
        );
×
43
    }
44

45
    #[Override]
46
    protected function validate(): void
47
    {
48
        if ($this->isEmpty) {
1,376✔
NEW
49
            return;
×
50
        }
51

52
        if ($this->exteriorRing()->numPoints() !== 4) {
1,376✔
53
            throw new InvalidGeometryException('A Triangle must have exactly 4 (3 + first again) points.');
8✔
54
        }
55

56
        if ($this->numInteriorRings() !== 0) {
1,368✔
57
            throw new InvalidGeometryException('A Triangle must not have interior rings.');
8✔
58
        }
59
    }
60
}
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