芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/giga.mgaplay.com.br/vendor/mongodb/mongodb/src/Operation/Explain.php
databaseName = $databaseName; $this->explainable = $explainable; $this->options = $options; } /** * Execute the operation. * * @see Executable::execute() * @param Server $server * @return array|object * @throws UnsupportedException if the server does not support explaining the operation * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ public function execute(Server $server) { if ($this->explainable instanceof Distinct && ! server_supports_feature($server, self::$wireVersionForDistinct)) { throw UnsupportedException::explainNotSupported(); } if ($this->isFindAndModify($this->explainable) && ! server_supports_feature($server, self::$wireVersionForFindAndModify)) { throw UnsupportedException::explainNotSupported(); } if ($this->explainable instanceof Aggregate && ! server_supports_feature($server, self::$wireVersionForAggregate)) { throw UnsupportedException::explainNotSupported(); } $cmd = ['explain' => $this->explainable->getCommandDocument($server)]; if (isset($this->options['verbosity'])) { $cmd['verbosity'] = $this->options['verbosity']; } $cursor = $server->executeCommand($this->databaseName, new Command($cmd), $this->createOptions()); if (isset($this->options['typeMap'])) { $cursor->setTypeMap($this->options['typeMap']); } return current($cursor->toArray()); } /** * Create options for executing the command. * * @see http://php.net/manual/en/mongodb-driver-server.executecommand.php * @return array */ private function createOptions() { $options = []; if (isset($this->options['readPreference'])) { $options['readPreference'] = $this->options['readPreference']; } if (isset($this->options['session'])) { $options['session'] = $this->options['session']; } return $options; } private function isFindAndModify(Explainable $explainable): bool { if ($explainable instanceof FindAndModify || $explainable instanceof FindOneAndDelete || $explainable instanceof FindOneAndReplace || $explainable instanceof FindOneAndUpdate) { return true; } return false; } }