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

brick / geo / 13716844819

07 Mar 2025 08:35AM UTC coverage: 47.964% (+3.9%) from 44.086%
13716844819

push

github

BenMorel
Add TypeChecker for engines

8 of 21 new or added lines in 5 files covered. (38.1%)

98 existing lines in 18 files now uncovered.

1684 of 3511 relevant lines covered (47.96%)

944.32 hits per line

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

72.73
/src/IO/WKBTools.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Brick\Geo\IO;
6

7
use Brick\Geo\Exception\GeometryIOException;
8

9
/**
10
 * Tools for WKB classes.
11
 *
12
 * @internal
13
 */
14
abstract class WKBTools
15
{
16
    /**
17
     * @throws GeometryIOException
18
     */
19
    private static function checkDoubleIs64Bit() : void
20
    {
21
        if (strlen(pack('d', 0.0)) !== 8) {
6✔
UNCOV
22
            throw new GeometryIOException('The double type is not 64 bit on this platform.');
×
23
        }
24
    }
25

26
    /**
27
     * Detects the machine byte order (big endian or little endian).
28
     *
29
     * @throws GeometryIOException
30
     */
31
    public static function getMachineByteOrder() : WKBByteOrder
32
    {
33
        /** @var WKBByteOrder|null $byteOrder */
34
        static $byteOrder;
11,444✔
35

36
        if ($byteOrder === null) {
11,444✔
37
            self::checkDoubleIs64Bit();
6✔
38

39
            $byteOrder = match (pack('L', 0x61626364)) {
6✔
40
                'abcd' => WKBByteOrder::BIG_ENDIAN,
×
41
                'dcba' => WKBByteOrder::LITTLE_ENDIAN,
6✔
UNCOV
42
                default => throw GeometryIOException::unsupportedEndianness(),
×
43
            };
6✔
44
        }
45

46
        return $byteOrder;
11,444✔
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