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

brick / geo / 13715715561

06 Mar 2025 10:47PM UTC coverage: 44.086% (-40.4%) from 84.507%
13715715561

push

github

BenMorel
Remove Psalm-specific annotations

1543 of 3500 relevant lines covered (44.09%)

270.91 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
/**
13
 * A Triangle is a Polygon with 3 distinct, non-collinear vertices and no interior boundary.
14
 */
15
class Triangle extends Polygon
16
{
17
    #[Override]
18
    protected function validate(): void
19
    {
20
        if ($this->isEmpty) {
344✔
21
            return;
×
22
        }
23

24
        if ($this->exteriorRing()->numPoints() !== 4) {
344✔
25
            throw new InvalidGeometryException('A Triangle must have exactly 4 (3 + first again) points.');
2✔
26
        }
27

28
        if ($this->numInteriorRings() !== 0) {
342✔
29
            throw new InvalidGeometryException('A Triangle must not have interior rings.');
2✔
30
        }
31
    }
32

33
    #[NoProxy, Override]
34
    public function geometryType() : string
35
    {
36
        return 'Triangle';
170✔
37
    }
38

39
    #[NoProxy, Override]
40
    public function geometryTypeBinary() : int
41
    {
42
        return Geometry::TRIANGLE;
144✔
43
    }
44

45
    #[Override]
46
    public function project(Projector $projector): Triangle
47
    {
48
        return new Triangle(
×
49
            $projector->getTargetCoordinateSystem($this->coordinateSystem),
×
50
            ...array_map(
×
51
                fn (LineString $ring) => $ring->project($projector),
×
52
                $this->rings,
×
53
            ),
×
54
        );
×
55
    }
56
}
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