@@ -41,34 +41,32 @@ public function __call($method, $parameters)
4141 $ start = microtime (true );
4242 $ result = call_user_func_array ([$ this ->collection , $ method ], $ parameters );
4343
44- if ($ this ->connection ->logging ()) {
45- // Once we have run the query we will calculate the time that it took to run and
46- // then log the query, bindings, and execution time so we will report them on
47- // the event that the developer needs them. We'll log time in milliseconds.
48- $ time = $ this ->connection ->getElapsedTime ($ start );
44+ // Once we have run the query we will calculate the time that it took to run and
45+ // then log the query, bindings, and execution time so we will report them on
46+ // the event that the developer needs them. We'll log time in milliseconds.
47+ $ time = $ this ->connection ->getElapsedTime ($ start );
4948
50- $ query = [];
49+ $ query = [];
5150
52- // Convert the query parameters to a json string.
53- array_walk_recursive ($ parameters , function (&$ item , $ key ) {
54- if ($ item instanceof ObjectID) {
55- $ item = (string ) $ item ;
56- }
57- });
51+ // Convert the query parameters to a json string.
52+ array_walk_recursive ($ parameters , function (&$ item , $ key ) {
53+ if ($ item instanceof ObjectID) {
54+ $ item = (string ) $ item ;
55+ }
56+ });
5857
59- // Convert the query parameters to a json string.
60- foreach ($ parameters as $ parameter ) {
61- try {
62- $ query [] = json_encode ($ parameter );
63- } catch (Exception $ e ) {
64- $ query [] = '{...} ' ;
65- }
58+ // Convert the query parameters to a json string.
59+ foreach ($ parameters as $ parameter ) {
60+ try {
61+ $ query [] = json_encode ($ parameter );
62+ } catch (Exception $ e ) {
63+ $ query [] = '{...} ' ;
6664 }
65+ }
6766
68- $ queryString = $ this ->collection ->getCollectionName () . '. ' . $ method . '( ' . implode (', ' , $ query ) . ') ' ;
67+ $ queryString = $ this ->collection ->getCollectionName () . '. ' . $ method . '( ' . implode (', ' , $ query ) . ') ' ;
6968
70- $ this ->connection ->logQuery ($ queryString , [], $ time );
71- }
69+ $ this ->connection ->logQuery ($ queryString , [], $ time );
7270
7371 return $ result ;
7472 }
0 commit comments