count($this->sql_queries), 'accumulated_duration' => $this->totalExecTime, 'accumulated_duration_str' => round($this->totalExecTime, 4), 'statements' => $this->sql_queries, 'nb_failed_statements' => $this->nb_failed_statements, 'memory_usage' => $this->total_memory, 'memory_usage_str' => round($this->total_memory/1000000, 1) . " Mo", 'peak_memory_usage' => $this->max_memory, 'peak_memory_usage_str' => round($this->max_memory/1000000, 1) . " Mo", ]; } public function getName() { return 'sql_queries'; } public function addQuery($query) { $this->sql_queries[] = $query; $this->totalExecTime += $query['duration']; $this->total_memory += $query['memory']; $this->max_memory = max($this->max_memory, $query['memory']); if ($query['is_success'] === false) { $this->nb_failed_statements += 1; } } public function getWidgets() { return [ "sql" => [ "icon" => "inbox", "tooltip" => "SQL Queries", //"widget" => "PhpDebugBar.Widget", "widget" => "PhpDebugBar.Widgets.SQLQueriesWidget", //"widget" => "PhpDebugBar.Widgets.MessagesWidget", "map" => "sql_queries", "default" => "[]" ], "sql:badge" => [ "map" => "sql_queries.nb_statements", "default" => 0 ], ]; } public function getAssets() { return array( 'css' => 'widgets/sqlqueries/widget.css', 'js' => 'widgets/sqlqueries/widget.js' ); } }