CodeExplorer calculateStatistics example
public function collect(Request
$request, Response
$response, \Throwable
$exception = null
): void
{ $empty =
['calls' =>
[], 'adapters' =>
[], 'config' =>
[], 'options' =>
[], 'statistics' =>
[]];
$this->data =
['instances' =>
$empty, 'total' =>
$empty];
foreach ($this->instances
as $name =>
$instance) { $this->data
['instances'
]['calls'
][$name] =
$instance->
getCalls();
$this->data
['instances'
]['adapters'
][$name] =
get_debug_type($instance->
getPool());
} $this->data
['instances'
]['statistics'
] =
$this->
calculateStatistics();
$this->data
['total'
]['statistics'
] =
$this->
calculateTotalStatistics();
} public function reset(): void
{ $this->data =
[];
foreach ($this->instances
as $instance) { $instance->
clearCalls();
} }