瀏覽代碼

Work around syntax uniqueness in PHP 5.5

Andreas Braun 10 年之前
父節點
當前提交
c29d9bff97
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      lib/Mongo/MongoClient.php

+ 5 - 1
lib/Mongo/MongoClient.php

@@ -66,8 +66,12 @@ class MongoClient
      * @param array $driverOptions An array of options for the MongoDB driver.
      * @throws MongoConnectionException
      */
-    public function __construct($server = 'mongodb://' . self::DEFAULT_HOST . ':' . self::DEFAULT_PORT, array $options = ["connect" => true], array $driverOptions = [])
+    public function __construct($server = 'default', array $options = ["connect" => true], array $driverOptions = [])
     {
+        if ($server === 'default') {
+            $server = 'mongodb://' . self::DEFAULT_HOST . ':' . self::DEFAULT_PORT;
+        }
+
         $this->server = $server;
         $this->client = new Client($server, $options, $driverOptions);