|
4 | 4 |
|
5 | 5 | class ProfiledQueryPlan |
6 | 6 | { |
7 | | - private int $dbHits; |
8 | | - private int $records; |
9 | | - private bool $hasPageCacheStats; |
10 | | - private int $pageCacheHits; |
11 | | - private int $pageCacheMisses; |
12 | | - private float $pageCacheHitRatio; |
13 | | - private int $time; |
14 | | - private string $operatorType; |
15 | | - private ProfiledQueryPlanArguments $arguments; |
16 | | - |
17 | | - /** |
18 | | - * @var list<ProfiledQueryPlan> |
19 | | - */ |
20 | | - private array $children; |
21 | | - |
22 | | - /** |
23 | | - * @var string[] |
24 | | - */ |
25 | | - private array $identifiers; |
| 7 | + public readonly int $dbHits; |
| 8 | + public readonly int $records; |
| 9 | + public readonly bool $hasPageCacheStats; |
| 10 | + public readonly int $pageCacheHits; |
| 11 | + public readonly int $pageCacheMisses; |
| 12 | + public readonly float $pageCacheHitRatio; |
| 13 | + public readonly int $time; |
| 14 | + public readonly string $operatorType; |
| 15 | + public readonly ProfiledQueryPlanArguments $arguments; |
| 16 | + public readonly array $children; |
| 17 | + public readonly array $identifiers; |
26 | 18 |
|
27 | 19 | public function __construct( |
28 | | - ?int $dbHits, |
29 | | - ?int $records, |
30 | | - ?bool $hasPageCacheStats, |
31 | | - ?int $pageCacheHits, |
32 | | - ?int $pageCacheMisses, |
33 | | - ?float $pageCacheHitRatio, |
34 | | - ?int $time, |
35 | | - ?string $operatorType, |
| 20 | + int $dbHits = 0, |
| 21 | + int $records = 0, |
| 22 | + bool $hasPageCacheStats = false, |
| 23 | + int $pageCacheHits = 0, |
| 24 | + int $pageCacheMisses = 0, |
| 25 | + float $pageCacheHitRatio = 0.0, |
| 26 | + int $time = 0, |
| 27 | + string $operatorType = '', |
36 | 28 | ProfiledQueryPlanArguments $arguments, |
37 | | - ?array $children = [], |
38 | | - array $identifiers = [] // Default to an empty array |
| 29 | + array $children = [], |
| 30 | + array $identifiers = [] |
39 | 31 | ) { |
40 | | - $this->dbHits = $dbHits ?? 0; |
41 | | - $this->records = $records ?? 0; |
42 | | - $this->hasPageCacheStats = $hasPageCacheStats ?? false; |
43 | | - $this->pageCacheHits = $pageCacheHits ?? 0; |
44 | | - $this->pageCacheMisses = $pageCacheMisses ?? 0; |
45 | | - $this->pageCacheHitRatio = $pageCacheHitRatio ?? 0.0; |
46 | | - $this->time = $time ?? 0; |
47 | | - $this->operatorType = $operatorType ?? ''; |
| 32 | + $this->dbHits = $dbHits; |
| 33 | + $this->records = $records; |
| 34 | + $this->hasPageCacheStats = $hasPageCacheStats; |
| 35 | + $this->pageCacheHits = $pageCacheHits; |
| 36 | + $this->pageCacheMisses = $pageCacheMisses; |
| 37 | + $this->pageCacheHitRatio = $pageCacheHitRatio; |
| 38 | + $this->time = $time; |
| 39 | + $this->operatorType = $operatorType; |
48 | 40 | $this->arguments = $arguments; |
49 | | - $this->children = $children ?? []; |
| 41 | + $this->children = $children; |
50 | 42 | $this->identifiers = $identifiers; |
51 | 43 | } |
52 | | - |
53 | | - /** |
54 | | - * @api |
55 | | - */ |
56 | | - public function getDbHits(): int |
57 | | - { |
58 | | - return $this->dbHits; |
59 | | - } |
60 | | - |
61 | | - /** |
62 | | - * @api |
63 | | - */ |
64 | | - public function getRecords(): int |
65 | | - { |
66 | | - return $this->records; |
67 | | - } |
68 | | - /** |
69 | | - * @api |
70 | | - */ |
71 | | - |
72 | | - public function hasPageCacheStats(): bool |
73 | | - { |
74 | | - return $this->hasPageCacheStats; |
75 | | - } |
76 | | - /** |
77 | | - * @api |
78 | | - */ |
79 | | - |
80 | | - public function getPageCacheHits(): int |
81 | | - { |
82 | | - return $this->pageCacheHits; |
83 | | - } |
84 | | - /** |
85 | | - * @api |
86 | | - */ |
87 | | - |
88 | | - public function getPageCacheMisses(): int |
89 | | - { |
90 | | - return $this->pageCacheMisses; |
91 | | - } |
92 | | - /** |
93 | | - * @api |
94 | | - */ |
95 | | - |
96 | | - public function getPageCacheHitRatio(): float |
97 | | - { |
98 | | - return $this->pageCacheHitRatio; |
99 | | - } |
100 | | - /** |
101 | | - * @api |
102 | | - */ |
103 | | - |
104 | | - public function getTime(): int |
105 | | - { |
106 | | - return $this->time; |
107 | | - } |
108 | | - /** |
109 | | - * @api |
110 | | - */ |
111 | | - |
112 | | - public function getOperatorType(): string |
113 | | - { |
114 | | - return $this->operatorType; |
115 | | - } |
116 | | - /** |
117 | | - * @api |
118 | | - */ |
119 | | - |
120 | | - public function getArguments(): ProfiledQueryPlanArguments |
121 | | - { |
122 | | - return $this->arguments; |
123 | | - } |
124 | | - |
125 | | - /** |
126 | | - * @api |
127 | | - * @return list<ProfiledQueryPlan> |
128 | | - */ |
129 | | - public function getChildren(): array |
130 | | - { |
131 | | - return $this->children; |
132 | | - } |
133 | | - /** |
134 | | - * @api |
135 | | - */ |
136 | | - |
137 | | - public function addChild(ProfiledQueryPlan|ProfiledQueryPlanArguments $child): void |
138 | | - { |
139 | | - $this->children[] = $child; |
140 | | - } |
141 | | - |
142 | | - /** |
143 | | - * @return string[] |
144 | | - */ |
145 | | - public function getIdentifiers(): array |
146 | | - { |
147 | | - return $this->identifiers; |
148 | | - } |
149 | | - |
150 | | - /** |
151 | | - * @param string[] $identifiers |
152 | | - */ |
153 | | - public function setIdentifiers(array $identifiers): void |
154 | | - { |
155 | | - $this->identifiers = $identifiers; |
156 | | - } |
157 | | - |
158 | | - public function addIdentifier(string $identifier): void |
159 | | - { |
160 | | - $this->identifiers[] = $identifier; |
161 | | - } |
162 | 44 | } |
0 commit comments