19
19
class MongoDbSessionHandler implements \SessionHandlerInterface
20
20
{
21
21
/**
22
- * @var \Mongo
22
+ * @var \Mongo|\MongoClient|\MongoDB\Client
23
23
*/
24
24
private $ mongo ;
25
25
@@ -108,7 +108,7 @@ public function close()
108
108
*/
109
109
public function destroy ($ sessionId )
110
110
{
111
- $ methodName = ( $ this ->mongo instanceof \MongoDB \Client) ? 'deleteOne ' : 'remove ' ;
111
+ $ methodName = $ this ->mongo instanceof \MongoDB \Client ? 'deleteOne ' : 'remove ' ;
112
112
113
113
$ this ->getCollection ()->$ methodName (array (
114
114
$ this ->options ['id_field ' ] => $ sessionId ,
@@ -122,7 +122,7 @@ public function destroy($sessionId)
122
122
*/
123
123
public function gc ($ maxlifetime )
124
124
{
125
- $ methodName = ( $ this ->mongo instanceof \MongoDB \Client) ? 'deleteOne ' : 'remove ' ;
125
+ $ methodName = $ this ->mongo instanceof \MongoDB \Client ? 'deleteOne ' : 'remove ' ;
126
126
127
127
$ this ->getCollection ()->$ methodName (array (
128
128
$ this ->options ['expiry_field ' ] => array ('$lt ' => $ this ->createDateTime ()),
@@ -152,7 +152,7 @@ public function write($sessionId, $data)
152
152
$ options ['multiple ' ] = false ;
153
153
}
154
154
155
- $ methodName = ( $ this ->mongo instanceof \MongoDB \Client) ? 'updateOne ' : 'update ' ;
155
+ $ methodName = $ this ->mongo instanceof \MongoDB \Client ? 'updateOne ' : 'update ' ;
156
156
157
157
$ this ->getCollection ()->$ methodName (
158
158
array ($ this ->options ['id_field ' ] => $ sessionId ),
@@ -201,7 +201,7 @@ private function getCollection()
201
201
/**
202
202
* Return a Mongo instance.
203
203
*
204
- * @return \Mongo
204
+ * @return \Mongo|\MongoClient|\MongoDB\Client
205
205
*/
206
206
protected function getMongo ()
207
207
{
@@ -217,7 +217,7 @@ protected function getMongo()
217
217
*/
218
218
private function createDateTime ($ seconds = null )
219
219
{
220
- if (is_null ( $ seconds) ) {
220
+ if (null === $ seconds ) {
221
221
$ seconds = time ();
222
222
}
223
223
0 commit comments