| 1 | <?php |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * Collector priority |
||
| 22 | */ |
||
| 23 | public const PRIORITY = 10; |
||
| 24 | |||
| 25 | protected DebugStack $sqlLogger; |
||
|
|
|||
| 26 | |||
| 27 | protected string $name; |
||
| 28 | |||
| 29 | public function __construct(DebugStack $sqlLogger, string $name) |
||
| 30 | { |
||
| 31 | $this->sqlLogger = $sqlLogger; |
||
| 32 | $this->name = (string) $name; |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * {@inheritDoc} |
||
| 37 | */ |
||
| 38 | public function getName() |
||
| 39 | { |
||
| 40 | 11 | return $this->name; |
|
| 41 | } |
||
| 42 | 11 | ||
| 43 | 11 | /** |
|
| 44 | 11 | * {@inheritDoc} |
|
| 45 | */ |
||
| 46 | public function getPriority() |
||
| 47 | { |
||
| 48 | return self::PRIORITY; |
||
| 49 | 2 | } |
|
| 50 | |||
| 51 | 2 | /** |
|
| 52 | * {@inheritDoc} |
||
| 53 | */ |
||
| 54 | public function collect(MvcEvent $mvcEvent) |
||
| 55 | { |
||
| 56 | } |
||
| 57 | 1 | ||
| 58 | /** |
||
| 59 | 1 | * {@inheritDoc} |
|
| 60 | */ |
||
| 61 | public function canHide() |
||
| 62 | { |
||
| 63 | return empty($this->sqlLogger->queries); |
||
| 64 | } |
||
| 65 | 1 | ||
| 66 | public function getQueryCount() : int |
||
| 67 | 1 | { |
|
| 68 | return count($this->sqlLogger->queries); |
||
| 69 | } |
||
| 70 | |||
| 71 | /** |
||
| 72 | 1 | * @return array |
|
| 73 | */ |
||
| 74 | 1 | public function getQueries() : array |
|
| 75 | { |
||
| 76 | return $this->sqlLogger->queries; |
||
| 77 | } |
||
| 78 | |||
| 79 | public function getQueryTime() : float |
||
| 80 | 1 | { |
|
| 81 | $time = 0.0; |
||
| 82 | 1 | ||
| 83 | foreach ($this->sqlLogger->queries as $query) { |
||
| 84 | $time += $query['executionMS']; |
||
| 85 | } |
||
| 86 | |||
| 87 | return $time; |
||
| 88 | } |
||
| 89 | } |
||
| 90 |