Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
GLTFComponentType
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 registry
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
2
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace MediaWiki\Extension\GLTFHandler\Parser;
4
5use function array_column;
6
7final class GLTFComponentType {
8
9    public const BYTE = 5120;
10    public const UNSIGNED_BYTE = 5121;
11    public const SHORT = 5122;
12    public const UNSIGNED_SHORT = 5123;
13    public const UNSIGNED_INT = 5125;
14    public const FLOAT = 5126;
15
16    /**
17     * @return non-empty-array<int, self>
18     */
19    public static function registry(): array {
20        return array_column( [
21            new self( self::BYTE, "BYTE", 1, "c", -0x7f - 1, 0x7f ),
22            new self( self::UNSIGNED_BYTE, "UNSIGNED_BYTE", 1, "C", 0, 0xff ),
23            new self( self::SHORT, "SHORT", 2, "s", -0x7fff - 1, 0x7fff ),
24            new self( self::UNSIGNED_SHORT, "UNSIGNED_SHORT", 2, "v", 0, 0xffff ),
25            new self( self::UNSIGNED_INT, "UNSIGNED_INT", 4, "V", 0, 0xffffffff ),
26            new self( self::FLOAT, "FLOAT", 4, "g", -3.4028237 * ( 10 ** 38 ), 3.4028237 * ( 10 ** 38 ) ),
27        ], null, "code" );
28    }
29
30    public function __construct(
31        public int $code,
32        public string $name,
33        public int $size,
34        public string $format,
35        public mixed $min,
36        public mixed $max
37    ) {
38    }
39}