Skip to content

Commit ce6e382

Browse files
raplidernicolas-grekas
raplider
authored andcommitted
remove unnecessary instanceof in MongoDbSessionHandler
1 parent 7a23c5e commit ce6e382

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

Session/Storage/Handler/MongoDbSessionHandler.php

+4-13
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class MongoDbSessionHandler extends AbstractSessionHandler
2424
private $mongo;
2525

2626
/**
27-
* @var \MongoCollection
27+
* @var \MongoDB\Collection
2828
*/
2929
private $collection;
3030

@@ -143,21 +143,12 @@ public function updateTimestamp($sessionId, $data)
143143
{
144144
$expiry = new \MongoDB\BSON\UTCDateTime((time() + (int) ini_get('session.gc_maxlifetime')) * 1000);
145145

146-
if ($this->mongo instanceof \MongoDB\Client) {
147-
$methodName = 'updateOne';
148-
$options = array();
149-
} else {
150-
$methodName = 'update';
151-
$options = array('multiple' => false);
152-
}
153-
154-
$this->getCollection()->$methodName(
146+
$this->getCollection()->updateOne(
155147
array($this->options['id_field'] => $sessionId),
156148
array('$set' => array(
157149
$this->options['time_field'] => new \MongoDB\BSON\UTCDateTime(),
158150
$this->options['expiry_field'] => $expiry,
159-
)),
160-
$options
151+
))
161152
);
162153

163154
return true;
@@ -181,7 +172,7 @@ protected function doRead($sessionId)
181172
}
182173

183174
/**
184-
* @return \MongoCollection
175+
* @return \MongoDB\Collection
185176
*/
186177
private function getCollection()
187178
{

0 commit comments

Comments
 (0)