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

brick / geo / 13753277563

09 Mar 2025 10:43PM UTC coverage: 49.787% (+2.5%) from 47.295%
13753277563

push

github

BenMorel
Prepare for release

1749 of 3513 relevant lines covered (49.79%)

975.53 hits per line

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

91.67
/src/IO/EWKTParser.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Brick\Geo\IO;
6

7
use Override;
8

9
/**
10
 * Parser for the Extended WKT format designed by PostGIS.
11
 *
12
 * @internal
13
 */
14
final class EWKTParser extends WKTParser
15
{
16
    protected const T_SRID = 1;
17
    protected const T_WORD = 2;
18
    protected const T_NUMBER = 3;
19

20
    protected const REGEX_SRID = 'SRID\=([0-9]+)\s*;';
21

22
    #[Override]
23
    protected function getRegex() : array
24
    {
25
        return [
4,760✔
26
            self::T_SRID   => self::REGEX_SRID,
4,760✔
27
            self::T_WORD   => self::REGEX_WORD,
4,760✔
28
            self::T_NUMBER => self::REGEX_NUMBER,
4,760✔
29
        ];
4,760✔
30
    }
31

32
    public function getOptionalSRID() : int
33
    {
34
        $token = $this->tokens[$this->current] ?? null;
4,760✔
35

36
        if ($token === null) {
4,760✔
37
            return 0;
×
38
        }
39

40
        if ($token[0] !== self::T_SRID) {
4,760✔
41
            return 0;
2,380✔
42
        }
43

44
        $this->current++;
2,380✔
45

46
        return (int) $token[1];
2,380✔
47
    }
48
}
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