1919class MongoDbSessionHandler implements \SessionHandlerInterface
2020{
2121 /**
22- * @var \Mongo
22+ * @var \Mongo|\MongoClient|\MongoDB\Client
2323 */
2424 private $ mongo ;
2525
@@ -108,7 +108,7 @@ public function close()
108108 */
109109 public function destroy ($ sessionId )
110110 {
111- $ methodName = ( $ this ->mongo instanceof \MongoDB \Client) ? 'deleteOne ' : 'remove ' ;
111+ $ methodName = $ this ->mongo instanceof \MongoDB \Client ? 'deleteOne ' : 'remove ' ;
112112
113113 $ this ->getCollection ()->$ methodName (array (
114114 $ this ->options ['id_field ' ] => $ sessionId ,
@@ -122,7 +122,7 @@ public function destroy($sessionId)
122122 */
123123 public function gc ($ maxlifetime )
124124 {
125- $ methodName = ( $ this ->mongo instanceof \MongoDB \Client) ? 'deleteOne ' : 'remove ' ;
125+ $ methodName = $ this ->mongo instanceof \MongoDB \Client ? 'deleteOne ' : 'remove ' ;
126126
127127 $ this ->getCollection ()->$ methodName (array (
128128 $ this ->options ['expiry_field ' ] => array ('$lt ' => $ this ->createDateTime ()),
@@ -152,7 +152,7 @@ public function write($sessionId, $data)
152152 $ options ['multiple ' ] = false ;
153153 }
154154
155- $ methodName = ( $ this ->mongo instanceof \MongoDB \Client) ? 'updateOne ' : 'update ' ;
155+ $ methodName = $ this ->mongo instanceof \MongoDB \Client ? 'updateOne ' : 'update ' ;
156156
157157 $ this ->getCollection ()->$ methodName (
158158 array ($ this ->options ['id_field ' ] => $ sessionId ),
@@ -201,7 +201,7 @@ private function getCollection()
201201 /**
202202 * Return a Mongo instance.
203203 *
204- * @return \Mongo
204+ * @return \Mongo|\MongoClient|\MongoDB\Client
205205 */
206206 protected function getMongo ()
207207 {
@@ -217,7 +217,7 @@ protected function getMongo()
217217 */
218218 private function createDateTime ($ seconds = null )
219219 {
220- if (is_null ( $ seconds) ) {
220+ if (null === $ seconds ) {
221221 $ seconds = time ();
222222 }
223223
0 commit comments