Elf64DynamicStructure::isGnuHashTable()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 1
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
/**
4
 * This file is part of the sj-i/php-profiler package.
5
 *
6
 * (c) sji <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace PhpProfiler\Lib\Elf\Structure\Elf64;
15
16
use PhpProfiler\Lib\Integer\UInt64;
17
18
final class Elf64DynamicStructure
19
{
20
    public const DT_NULL = 0;
21
    public const DT_NEEDED = 1;
22
    public const DT_PLTRELSZ = 2;
23
    public const DT_PLTGOT = 3;
24
    public const DT_HASH = 4;
25
    public const DT_STRTAB = 5;
26
    public const DT_SYMTAB = 6;
27
    public const DT_RELA = 7;
28
    public const DT_RELASZ = 8;
29
    public const DT_RELAENT = 9;
30
    public const DT_STRSZ = 10;
31
    public const DT_SYMENT = 11;
32
    public const DT_INIT = 12;
33
    public const DT_FINI = 13;
34
    public const DT_SONAME = 14;
35
    public const DT_RPATH = 15;
36
    public const DT_SYMBOLIC = 16;
37
    public const DT_REL = 17;
38
    public const DT_RELSZ = 18;
39
    public const DT_RELENT = 19;
40
    public const DT_PLTREL = 20;
41
    public const DT_DEBUG = 21;
42
    public const DT_TEXTREL = 22;
43
    public const DT_JMPREL = 23;
44
    public const DT_BIND_NOW = 24;
45
    public const DT_INIT_ARRAY = 25;
46
    public const DT_FINI_ARRAY = 26;
47
    public const DT_INIT_ARRAYSZ = 27;
48
    public const DT_FINI_ARRAYSZ = 28;
49
    public const DT_RUNPATH = 29;
50
    public const DT_FLAGS = 30;
51
    public const DT_ENCODINGS = 31;
52
    public const DT_PREINIT_ARRAY = 32;
53
    public const DT_PREINIT_ARRAYSZ = 33;
54
    public const DT_LOOS = 0x6000000d;
55
    public const DT_HIOS = 0x6ffff000;
56
    public const DT_RELACOUNT = 0x6ffffff9;
57
    public const DT_GNU_HASH = 0x6ffffef5;
58
    public const DT_FLAGS_1 = 0x6ffffffb;
59
    public const DT_VERNEED = 0x6ffffffe;
60
    public const DT_VERNEEDNUM = 0x6fffffff;
61
    public const DT_VERSYM = 0x6ffffff0;
62
    public const DT_LOPROC = 0x70000000;
63
    public const DT_HIPROC = 0x7fffffff;
64
65
    public const DF_ORIGIN = 1;
66
    public const DF_SYMBOLIC = 2;
67
    public const DF_TEXTREL = 4;
68
    public const DF_BIND_NOW = 8;
69
70
    public function __construct(
71
        public UInt64 $d_tag,
72
        public UInt64 $d_un
73
    ) {
74
    }
75
76
    public function isEnd(): bool
77
    {
78
        return $this->d_tag->hi === 0 and $this->d_tag->lo === self::DT_NULL;
79
    }
80
81
    public function isHashTable(): bool
82
    {
83
        return $this->d_tag->hi === 0 and $this->d_tag->lo === self::DT_HASH;
84
    }
85
86
    public function isGnuHashTable(): bool
87
    {
88
        return $this->d_tag->hi === 0 and $this->d_tag->lo === self::DT_GNU_HASH;
89
    }
90
91
    public function isStringTable(): bool
92
    {
93
        return $this->d_tag->hi === 0 and $this->d_tag->lo === self::DT_STRTAB;
94
    }
95
96
    public function isStringTableSize(): bool
97
    {
98
        return $this->d_tag->hi === 0 and $this->d_tag->lo === self::DT_STRSZ;
99
    }
100
101
    public function isSymbolTable(): bool
102
    {
103
        return $this->d_tag->hi === 0 and $this->d_tag->lo === self::DT_SYMTAB;
104
    }
105
106
    public function isSymbolTableEntrySize(): bool
107
    {
108
        return $this->d_tag->hi === 0 and $this->d_tag->lo === self::DT_SYMENT;
109
    }
110
111
    public function isDebug(): bool
112
    {
113
        return $this->d_tag->hi === 0 and $this->d_tag->lo === self::DT_DEBUG;
114
    }
115
}
116