1 | <?php |
||
21 | class Collector extends DataCollector |
||
22 | { |
||
23 | /** |
||
24 | * @var Stack|null |
||
25 | */ |
||
26 | private $activeStack; |
||
27 | |||
28 | 18 | public function __construct() |
|
32 | |||
33 | /** |
||
34 | * {@inheritdoc} |
||
35 | */ |
||
36 | 1 | public function collect(Request $request, Response $response, Exception $exception = null) |
|
40 | |||
41 | /** |
||
42 | * {@inheritdoc} |
||
43 | */ |
||
44 | 18 | public function reset() |
|
49 | |||
50 | /** |
||
51 | * {@inheritdoc} |
||
52 | */ |
||
53 | 2 | public function getName() |
|
57 | |||
58 | /** |
||
59 | * Mark the stack as active. If a stack was already active, use it as parent for our stack. |
||
60 | * |
||
61 | * @param Stack $stack |
||
62 | */ |
||
63 | 7 | public function activateStack(Stack $stack) |
|
64 | { |
||
65 | 7 | if (null !== $this->activeStack) { |
|
66 | 2 | $stack->setParent($this->activeStack); |
|
|
|||
67 | } |
||
68 | |||
69 | 7 | $this->activeStack = $stack; |
|
70 | 7 | } |
|
71 | |||
72 | /** |
||
73 | * Mark the stack as inactive. |
||
74 | * |
||
75 | * @param Stack $stack |
||
76 | */ |
||
77 | 5 | public function deactivateStack(Stack $stack) |
|
81 | |||
82 | /** |
||
83 | * @return Stack|null |
||
84 | */ |
||
85 | 7 | public function getActiveStack() |
|
89 | |||
90 | /** |
||
91 | * @param Stack $stack |
||
92 | */ |
||
93 | 6 | public function addStack(Stack $stack) |
|
97 | |||
98 | /** |
||
99 | * @param Stack $parent |
||
100 | * |
||
101 | * @return Stack[] |
||
102 | */ |
||
103 | public function getChildrenStacks(Stack $parent) |
||
109 | |||
110 | /** |
||
111 | * @return Stack[] |
||
112 | */ |
||
113 | 5 | public function getStacks() |
|
117 | |||
118 | /** |
||
119 | * @return Stack[] |
||
120 | */ |
||
121 | public function getSuccessfulStacks() |
||
127 | |||
128 | /** |
||
129 | * @return Stack[] |
||
130 | */ |
||
131 | public function getFailedStacks() |
||
137 | |||
138 | /** |
||
139 | * @return array |
||
140 | */ |
||
141 | public function getClients() |
||
142 | { |
||
143 | 3 | $stacks = array_filter($this->data['stacks'], function (Stack $stack) { |
|
144 | 2 | return null === $stack->getParent(); |
|
145 | 3 | }); |
|
146 | |||
147 | 3 | return array_unique(array_map(function (Stack $stack) { |
|
148 | 2 | return $stack->getClient(); |
|
149 | 3 | }, $stacks)); |
|
150 | } |
||
151 | |||
152 | /** |
||
153 | * @param $client |
||
154 | * |
||
155 | * @return Stack[] |
||
156 | */ |
||
157 | public function getClientRootStacks($client) |
||
163 | |||
164 | /** |
||
165 | * Count all messages for a client. |
||
166 | * |
||
167 | * @param $client |
||
168 | * |
||
169 | * @return int |
||
170 | */ |
||
171 | public function countClientMessages($client) |
||
177 | |||
178 | /** |
||
179 | * Recursively count message in stack. |
||
180 | * |
||
181 | * @param Stack $stack |
||
182 | * |
||
183 | * @return int |
||
184 | */ |
||
185 | private function countStackMessages(Stack $stack) |
||
191 | |||
192 | /** |
||
193 | * @return int |
||
194 | */ |
||
195 | public function getTotalDuration() |
||
201 | } |
||
202 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: