[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Part of the Joomla Framework Database Package 4 * 5 * @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved. 6 * @license GNU General Public License version 2 or later; see LICENSE 7 */ 8 9 namespace Joomla\Database\Monitor; 10 11 use Joomla\Database\QueryMonitorInterface; 12 13 /** 14 * Chained query monitor allowing multiple monitors to be executed. 15 * 16 * @since 2.0.0 17 */ 18 class ChainedMonitor implements QueryMonitorInterface 19 { 20 /** 21 * The query monitors stored to this chain 22 * 23 * @var QueryMonitorInterface[] 24 * @since 2.0.0 25 */ 26 private $monitors = []; 27 28 /** 29 * Register a monitor to the chain. 30 * 31 * @param QueryMonitorInterface $monitor The monitor to add. 32 * 33 * @return void 34 * 35 * @since 2.0.0 36 */ 37 public function addMonitor(QueryMonitorInterface $monitor): void 38 { 39 $this->monitors[] = $monitor; 40 } 41 42 /** 43 * Act on a query being started. 44 * 45 * @param string $sql The SQL to be executed. 46 * @param object[]|null $boundParams List of bound params, used with the query. 47 * Each item is an object that holds: value, dataType 48 * 49 * @return void 50 * 51 * @since 2.0.0 52 */ 53 public function startQuery(string $sql, ?array $boundParams = null): void 54 { 55 foreach ($this->monitors as $monitor) 56 { 57 $monitor->startQuery($sql, $boundParams); 58 } 59 } 60 61 /** 62 * Act on a query being stopped. 63 * 64 * @return void 65 * 66 * @since 2.0.0 67 */ 68 public function stopQuery(): void 69 { 70 foreach ($this->monitors as $monitor) 71 { 72 $monitor->stopQuery(); 73 } 74 } 75 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |