• 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

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✔
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,621✔
35

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

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

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