|
@@ -84,7 +84,7 @@ discard block |
|
|
block discarded – undo |
|
84
|
84
|
return false; |
|
85
|
85
|
} |
|
86
|
86
|
|
|
87
|
|
- return isset($result[ 'ok' ]) ? $result[ 'ok' ] == 1 : true; |
|
|
87
|
+ return isset($result['ok']) ? $result['ok'] == 1 : true; |
|
88
|
88
|
} else { |
|
89
|
89
|
throw new \InvalidArgumentException('Cross-Driver type confusion detected'); |
|
90
|
90
|
} |
|
@@ -102,9 +102,9 @@ discard block |
|
|
block discarded – undo |
|
102
|
102
|
|
|
103
|
103
|
if ($document) { |
|
104
|
104
|
return [ |
|
105
|
|
- self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin), |
|
106
|
|
- self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec), |
|
107
|
|
- self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->bin), |
|
|
105
|
+ self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[self::DRIVER_DATA_WRAPPER_INDEX]->bin), |
|
|
106
|
+ self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_TIME_WRAPPER_INDEX]->sec), |
|
|
107
|
+ self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[self::DRIVER_TAGS_WRAPPER_INDEX]->bin), |
|
108
|
108
|
]; |
|
109
|
109
|
} else { |
|
110
|
110
|
return null; |
|
@@ -124,7 +124,7 @@ discard block |
|
|
block discarded – undo |
|
124
|
124
|
if ($item instanceof Item) { |
|
125
|
125
|
$deletionResult = (array) $this->getCollection()->remove(['_id' => $item->getKey()], ["w" => 1]); |
|
126
|
126
|
|
|
127
|
|
- return (int) $deletionResult[ 'ok' ] === 1 && !$deletionResult[ 'err' ]; |
|
|
127
|
+ return (int) $deletionResult['ok'] === 1 && !$deletionResult['err']; |
|
128
|
128
|
} else { |
|
129
|
129
|
throw new \InvalidArgumentException('Cross-Driver type confusion detected'); |
|
130
|
130
|
} |
|
@@ -148,11 +148,11 @@ discard block |
|
|
block discarded – undo |
|
148
|
148
|
if ($this->instance instanceof MongodbClient) { |
|
149
|
149
|
throw new LogicException('Already connected to Mongodb server'); |
|
150
|
150
|
} else { |
|
151
|
|
- $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
152
|
|
- $port = isset($this->config[ 'port' ]) ? $this->config[ 'port' ] : '27017'; |
|
153
|
|
- $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : 3; |
|
154
|
|
- $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
155
|
|
- $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
|
|
151
|
+ $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
|
152
|
+ $port = isset($this->config['port']) ? $this->config['port'] : '27017'; |
|
|
153
|
+ $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : 3; |
|
|
154
|
+ $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
|
155
|
+ $username = isset($this->config['username']) ? $this->config['username'] : ''; |
|
156
|
156
|
|
|
157
|
157
|
|
|
158
|
158
|
/** |
|
@@ -200,8 +200,8 @@ discard block |
|
|
block discarded – undo |
|
200
|
200
|
]); |
|
201
|
201
|
|
|
202
|
202
|
$stats = (new driverStatistic()) |
|
203
|
|
- ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1) . "\n For more information see RawData.") |
|
204
|
|
- ->setSize((int) @$collStats[ 'size' ]) |
|
|
203
|
+ ->setInfo('MongoDB version ' . $serverStatus['version'] . ', Uptime (in days): ' . round($serverStatus['uptime'] / 86400, 1) . "\n For more information see RawData.") |
|
|
204
|
+ ->setSize((int) @$collStats['size']) |
|
205
|
205
|
->setData(implode(', ', array_keys($this->itemInstances))) |
|
206
|
206
|
->setRawData([ |
|
207
|
207
|
'serverStatus' => $serverStatus, |