|
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\PhpInternals\Types\Zend; |
|
15
|
|
|
|
|
16
|
|
|
use FFI\CData; |
|
17
|
|
|
use PhpProfiler\Lib\Process\Pointer\Pointer; |
|
18
|
|
|
|
|
19
|
|
|
class ZendValue |
|
20
|
|
|
{ |
|
21
|
|
|
/** @psalm-suppress PropertyNotSetInConstructor */ |
|
22
|
|
|
public int $lval; |
|
23
|
|
|
/** @psalm-suppress PropertyNotSetInConstructor */ |
|
24
|
|
|
public float $dval; |
|
25
|
|
|
/** @psalm-suppress PropertyNotSetInConstructor */ |
|
26
|
|
|
public Pointer $counted; |
|
27
|
|
|
/** @psalm-suppress PropertyNotSetInConstructor */ |
|
28
|
|
|
public Pointer $str; |
|
29
|
|
|
/** @psalm-suppress PropertyNotSetInConstructor */ |
|
30
|
|
|
public Pointer $obj; |
|
31
|
|
|
/** @psalm-suppress PropertyNotSetInConstructor */ |
|
32
|
|
|
public Pointer $res; |
|
33
|
|
|
/** @psalm-suppress PropertyNotSetInConstructor */ |
|
34
|
|
|
public Pointer $ref; |
|
35
|
|
|
/** @psalm-suppress PropertyNotSetInConstructor */ |
|
36
|
|
|
public Pointer $ast; |
|
37
|
|
|
/** @psalm-suppress PropertyNotSetInConstructor */ |
|
38
|
|
|
/** @psalm-suppress PropertyNotSetInConstructor */ |
|
39
|
|
|
public Pointer $zv; |
|
40
|
|
|
/** @psalm-suppress PropertyNotSetInConstructor */ |
|
41
|
|
|
public Pointer $ptr; |
|
42
|
|
|
/** @psalm-suppress PropertyNotSetInConstructor */ |
|
43
|
|
|
/** @psalm-suppress PropertyNotSetInConstructor */ |
|
44
|
|
|
public Pointer $ce; |
|
45
|
|
|
/** @psalm-suppress PropertyNotSetInConstructor */ |
|
46
|
|
|
public Pointer $func; |
|
47
|
|
|
/** @psalm-suppress PropertyNotSetInConstructor */ |
|
48
|
|
|
public ZendValueWw $ww; |
|
49
|
|
|
|
|
50
|
|
|
/** @param \FFI\PhpInternals\zend_value $cdata */ |
|
51
|
|
|
public function __construct( |
|
52
|
|
|
private CData $cdata |
|
53
|
|
|
) { |
|
54
|
|
|
unset($this->lval); |
|
55
|
|
|
unset($this->dval); |
|
56
|
|
|
unset($this->counted); |
|
57
|
|
|
unset($this->str); |
|
58
|
|
|
unset($this->obj); |
|
59
|
|
|
unset($this->res); |
|
60
|
|
|
unset($this->ref); |
|
61
|
|
|
unset($this->ast); |
|
62
|
|
|
unset($this->zv); |
|
63
|
|
|
unset($this->ptr); |
|
64
|
|
|
unset($this->ce); |
|
65
|
|
|
unset($this->func); |
|
66
|
|
|
unset($this->ww); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public function __get(string $field_name): mixed |
|
70
|
|
|
{ |
|
71
|
|
|
return match ($field_name) { |
|
72
|
|
|
'lval' => $this->lval = $this->cdata->lval, |
|
73
|
|
|
'dval' => $this->dval = $this->cdata->dval, |
|
74
|
|
|
'str' => $this->str = Pointer::fromCData( |
|
75
|
|
|
ZendString::class, |
|
76
|
|
|
$this->cdata->str, |
|
77
|
|
|
), |
|
78
|
|
|
}; |
|
79
|
|
|
} |
|
80
|
|
|
} |
|
81
|
|
|
|