Completed
Branch 1707_add_explain_command (e87963)
by Alessandro
08:07
created
src/Capsule/Database.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php declare(strict_types=1);
1
+<?php declare(strict_types = 1);
2 2
 
3 3
 namespace Facile\MongoDbBundle\Capsule;
4 4
 
Please login to merge, or discard this patch.
src/Twig/FacileMongoDbBundleExtension.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 class FacileMongoDbBundleExtension extends \Twig_Extension
6 6
 {
7
-    private $methodDataTranslationMap  = [
7
+    private $methodDataTranslationMap = [
8 8
         'aggregate' => 'Pipeline',
9 9
         'insertOne' => 'Document',
10 10
         'updateOne' => 'Update',
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     ];
16 16
 
17 17
     /**
18
-     * @return array
18
+     * @return \Twig_SimpleFunction[]
19 19
      */
20 20
     public function getFunctions()
21 21
     {
Please login to merge, or discard this patch.
src/Controller/ProfilerController.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare(strict_types=1);
1
+<?php declare(strict_types = 1);
2 2
 
3 3
 namespace Facile\MongoDbBundle\Controller;
4 4
 
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 
41 41
         $service = new ExplainQueryService($this->container->get('mongo.client_registry'));
42 42
 
43
-        try{
43
+        try {
44 44
             $result = $service->execute($query);
45
-        } catch (\InvalidArgumentException $e) {
45
+        }catch (\InvalidArgumentException $e) {
46 46
             return new JsonResponse([
47 47
                 "err" => $e->getMessage()
48 48
             ]);
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         foreach ($data as $key => $item) {
74 74
 
75 75
             if (is_string($item) && preg_match('/^ISODate/', $item)) {
76
-                $time = str_replace(['ISODate("','")'], '', $item);
76
+                $time = str_replace(['ISODate("', '")'], '', $item);
77 77
                 $dateTime = new \DateTime($time);
78 78
                 $item = new UTCDatetime($dateTime->getTimestamp() * 1000);
79 79
             }
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use Facile\MongoDbBundle\DataCollector\MongoQuerySerializer;
6 6
 use Facile\MongoDbBundle\Services\Explain\ExplainQueryService;
7
-use MongoDB\BSON\UTCDateTime;
8 7
 use Symfony\Component\DependencyInjection\Container;
9 8
 use Symfony\Component\DependencyInjection\ContainerAwareInterface;
10 9
 use Symfony\Component\DependencyInjection\ContainerInterface;
Please login to merge, or discard this patch.
src/Models/Query.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare(strict_types=1);
1
+<?php declare(strict_types = 1);
2 2
 
3 3
 namespace Facile\MongoDbBundle\Models;
4 4
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function setFilters($filters)
101 101
     {
102
-        $this->filters = (array)$filters ?? [];
102
+        $this->filters = (array) $filters ?? [];
103 103
     }
104 104
 
105 105
     /**
Please login to merge, or discard this patch.
src/Capsule/Client.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php declare(strict_types=1);
1
+<?php declare(strict_types = 1);
2 2
 
3 3
 namespace Facile\MongoDbBundle\Capsule;
4 4
 
Please login to merge, or discard this patch.
src/Capsule/Collection.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare(strict_types=1);
1
+<?php declare(strict_types = 1);
2 2
 
3 3
 namespace Facile\MongoDbBundle\Capsule;
4 4
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
      */
227 227
     private function translateReadPreference(ReadPreference $readPreference): string
228 228
     {
229
-        switch($readPreference->getMode()){
229
+        switch ($readPreference->getMode()) {
230 230
             case ReadPreference::RP_PRIMARY:
231 231
                 return 'primary';
232 232
             case ReadPreference::RP_PRIMARY_PREFERRED:
Please login to merge, or discard this patch.
src/Services/Explain/ExplainQueryService.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     const VERBOSITY_EXECUTION_STATS = 'executionStats';
14 14
     const VERBOSITY_ALL_PLAN_EXECUTION = 'allPlansExecution';
15 15
 
16
-    public static $acceptedMethods= [
16
+    public static $acceptedMethods = [
17 17
         'count',
18 18
         'distinct',
19 19
         'find',
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     {
57 57
         if (!in_array($query->getMethod(), self::$acceptedMethods)) {
58 58
             throw new \InvalidArgumentException(
59
-                'Cannot explain the method \''.$query->getMethod().'\'. Allowed methods: '. implode(', ',self::$acceptedMethods)
59
+                'Cannot explain the method \''.$query->getMethod().'\'. Allowed methods: '.implode(', ', self::$acceptedMethods)
60 60
             );
61 61
         };
62 62
 
Please login to merge, or discard this patch.
src/Services/Explain/ExplainCommandBuilder.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare(strict_types=1);
1
+<?php declare(strict_types = 1);
2 2
 
3 3
 namespace Facile\MongoDbBundle\Services\Explain;
4 4
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         $args = [
23 23
             $query->getMethod() => $query->getCollection(),
24 24
         ];
25
-        switch($query->getMethod()) {
25
+        switch ($query->getMethod()) {
26 26
             case 'count':
27 27
                 $args += self::getCountArgs($query);
28 28
                 break;
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         return [
116 116
             'delete' => $query->getCollection(),
117 117
             'deletes' => [
118
-                ['q' => $query->getFilters(), 'limit' => $query->getOptions()['limit'] ?? 0,]
118
+                ['q' => $query->getFilters(), 'limit' => $query->getOptions()['limit'] ?? 0, ]
119 119
             ]
120 120
         ];
121 121
     }
Please login to merge, or discard this patch.