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

brick / geo / 17456208570

04 Sep 2025 07:10AM UTC coverage: 50.432%. Remained the same
17456208570

push

github

BenMorel
Use @extends and @implements instead of @template-* variants

For consistency with the rest of the project.

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

47.37
/src/Exception/GeometryIoException.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Brick\Geo\Exception;
6

7
use JsonException;
8

9
use function sprintf;
10

11
/**
12
 * Exception thrown when an error occurs reading or writing WKT/WKB representations.
13
 */
14
final class GeometryIoException extends GeometryException
15
{
16
    public static function invalidWkb(string $message): GeometryIoException
17
    {
18
        return new self('Invalid WKB: ' . $message);
×
19
    }
20

21
    public static function invalidWkt(): GeometryIoException
22
    {
23
        return new self('Invalid WKT.');
×
24
    }
25

26
    public static function invalidEwkt(): GeometryIoException
27
    {
28
        return new self('Invalid EWKT.');
×
29
    }
30

31
    public static function invalidGeoJson(string $context, ?JsonException $e = null): GeometryIoException
32
    {
33
        $message = sprintf('Invalid GeoJSON: %s', $context);
24✔
34

35
        return new self($message, $e);
24✔
36
    }
37

38
    public static function unsupportedWkbType(int $wkbType): GeometryIoException
39
    {
40
        $message = sprintf('Unsupported WKB type: %d.', $wkbType);
×
41

42
        return new self($message);
×
43
    }
44

45
    public static function unsupportedGeoJsonType(string $geoJsonType): GeometryIoException
46
    {
47
        $message = sprintf('Unsupported GeoJSON type: %s.', $geoJsonType);
×
48

49
        return new self($message);
×
50
    }
51

52
    public static function unsupportedGeoJsonTypeWrongCase(string $wrongCase, string $correctCase): GeometryIoException
53
    {
54
        $message = sprintf(
248✔
55
            'Unsupported GeoJSON type: %s. The correct case is %s. ' .
248✔
56
            'You can allow incorrect cases by setting the $lenient flag to true.',
248✔
57
            $wrongCase,
248✔
58
            $correctCase,
248✔
59
        );
248✔
60

61
        return new self($message);
248✔
62
    }
63

64
    public static function unsupportedGeometryType(string $geometryType): GeometryIoException
65
    {
66
        $message = sprintf('Unsupported geometry type: %s.', $geometryType);
×
67

68
        return new self($message);
×
69
    }
70

71
    public static function unsupportedEndianness(): GeometryIoException
72
    {
73
        return new self('This platform has an unsupported endianness.');
×
74
    }
75
}
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