@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Facile\MongoDbBundle\Capsule; |
| 4 | 4 | |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Facile\MongoDbBundle\DataCollector\MongoQuerySerializer; |
| 6 | 6 | use Facile\MongoDbBundle\Services\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; |
@@ -1,4 +1,4 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | ]; |
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | - * @return array |
|
| 18 | + * @return \Twig_SimpleFunction[] |
|
| 19 | 19 | */ |
| 20 | 20 | public function getFunctions() |
| 21 | 21 | { |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | const VERBOSITY_EXECUTION_STATS = 'executionStats'; |
| 13 | 13 | const VERBOSITY_ALL_PLAN_EXECUTION = 'allPlansExecution'; |
| 14 | 14 | |
| 15 | - public static $acceptedMethods= [ |
|
| 15 | + public static $acceptedMethods = [ |
|
| 16 | 16 | 'count', |
| 17 | 17 | 'distinct', |
| 18 | 18 | 'find', |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | { |
| 56 | 56 | if (!in_array($query->getMethod(), self::$acceptedMethods)) { |
| 57 | 57 | throw new \InvalidArgumentException( |
| 58 | - 'Cannot explain the method \''.$query->getMethod().'\'. Allowed methods: '. implode(', ',self::$acceptedMethods) |
|
| 58 | + 'Cannot explain the method \''.$query->getMethod().'\'. Allowed methods: '.implode(', ', self::$acceptedMethods) |
|
| 59 | 59 | ); |
| 60 | 60 | }; |
| 61 | 61 | |
@@ -78,19 +78,19 @@ discard block |
||
| 78 | 78 | $args = [ |
| 79 | 79 | $query->getMethod() => $query->getCollection(), |
| 80 | 80 | ]; |
| 81 | - switch($query->getMethod()) { |
|
| 81 | + switch ($query->getMethod()) { |
|
| 82 | 82 | case 'count': |
| 83 | - $args += $this->getCountArgs($query);break; |
|
| 83 | + $args += $this->getCountArgs($query); break; |
|
| 84 | 84 | case 'find': |
| 85 | 85 | case 'findOne': |
| 86 | 86 | case 'findOneAndUpdate': |
| 87 | 87 | case 'findOneAndDelete': |
| 88 | - $args = $this->getFindArgs($query);break; |
|
| 88 | + $args = $this->getFindArgs($query); break; |
|
| 89 | 89 | case 'distinct': |
| 90 | - $args += $this->getDistinctArgs($query);break; |
|
| 90 | + $args += $this->getDistinctArgs($query); break; |
|
| 91 | 91 | case 'deleteOne': |
| 92 | 92 | case 'deleteMany': |
| 93 | - $args = $this->getDeleteArgs($query);break; |
|
| 93 | + $args = $this->getDeleteArgs($query); break; |
|
| 94 | 94 | case 'aggregate': |
| 95 | 95 | return new Command([ |
| 96 | 96 | 'aggregate' => $query->getCollection(), |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | return [ |
| 148 | 148 | 'delete' => $query->getCollection(), |
| 149 | 149 | 'deletes' => [ |
| 150 | - ['q' => $query->getFilters(), 'limit' => $query->getOptions()['limit'] ?? 0,] |
|
| 150 | + ['q' => $query->getFilters(), 'limit' => $query->getOptions()['limit'] ?? 0, ] |
|
| 151 | 151 | ] |
| 152 | 152 | ]; |
| 153 | 153 | } |
@@ -1,4 +1,4 @@ discard block |
||
| 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 |
||
| 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 | /** |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Facile\MongoDbBundle\Capsule; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ discard block |
||
| 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 |
||
| 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: |