Passed
Push — master ( 39df7e...5db39e )
by Shinji
02:01
created

ProcessMemoryArea   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
A isInRange() 0 4 2
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\Process\MemoryMap;
15
16
/**
17
 * Class ProcessMemoryArea
18
 * @package PhpProfiler\ProcessReader
19
 */
20
final class ProcessMemoryArea
21
{
22
    public string $begin;
23
    public string $end;
24
    public string $file_offset;
25
    public ProcessMemoryAttribute $attribute;
26
    public string $name;
27
28
    public function __construct(
29
        string $begin,
30
        string $end,
31
        string $file_offset,
32
        ProcessMemoryAttribute $attribute,
33
        string $name
34
    ) {
35
        $this->begin = $begin;
36
        $this->end = $end;
37
        $this->file_offset = $file_offset;
38
        $this->attribute = $attribute;
39
        $this->name = $name;
40
    }
41
42
    public function isInRange(int $address): bool
43
    {
44
        return $address >= hexdec($this->begin)
45
            and $address <= hexdec($this->end);
46
    }
47
}
48