golden hour
/opt/alt/tests/alt-php71-pecl-mongodb_1.11.1-1.el9/utils
⬆️ Go Up
Upload
File/Folder
Size
Actions
PHONGO-FIXTURES.json.gz
73.94 KB
Del
OK
basic-skipif.inc
795 B
Del
OK
basic.inc
549 B
Del
OK
classes.inc
1.47 KB
Del
OK
observer.php
1.07 KB
Del
OK
skipif.php
12.82 KB
Del
OK
tools.php
23.57 KB
Del
OK
Edit: observer.php
<?php use MongoDB\Driver\Monitoring\CommandFailedEvent; use MongoDB\Driver\Monitoring\CommandStartedEvent; use MongoDB\Driver\Monitoring\CommandSucceededEvent; use MongoDB\Driver\Monitoring\CommandSubscriber; /** * Observes command documents using the driver's monitoring API. */ class CommandObserver implements CommandSubscriber { private $commands = []; public function observe(callable $execution, callable $commandCallback) { $this->commands = []; \MongoDB\Driver\Monitoring\addSubscriber($this); try { call_user_func($execution); } finally { \MongoDB\Driver\Monitoring\removeSubscriber($this); foreach ($this->commands as $command) { call_user_func($commandCallback, $command); } } } public function commandStarted(CommandStartedEvent $event) { $this->commands[] = $event->getCommand(); } public function commandSucceeded(CommandSucceededEvent $event) { } public function commandFailed(CommandFailedEvent $event) { } } ?>
Save