Completed
Branch master (cfcded)
by Remy
04:36
created
DocumentManager/DocumentManager.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     }
137 137
 
138 138
     /**
139
-     * @param $collection
139
+     * @param string $collection
140 140
      * @param $id
141 141
      * @param array $options
142 142
      * @return null|object
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     }
148 148
 
149 149
     /**
150
-     * @param $collectionName
150
+     * @param string $collectionName
151 151
      * @param array $filter
152 152
      * @return \MongoDB\DeleteResult
153 153
      */
Please login to merge, or discard this patch.
Repository/Repository.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     /**
53 53
      * Repository constructor.
54 54
      * @param $name
55
-     * @param $manager
55
+     * @param \Pouzor\MongoDBBundle\DocumentManager\DocumentManager $manager
56 56
      */
57 57
     public function __construct($name, $manager)
58 58
     {
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      * Persist a document
144 144
      *
145 145
      * @param $document
146
-     * @return null | BulkWriteResult
146
+     * @return BulkWriteResult|null | BulkWriteResult
147 147
      */
148 148
     public function persist($document, $andFlush = false)
149 149
     {
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
     /**
546 546
      * Return the max value for a field in a collection
547 547
      *
548
-     * @param $field
548
+     * @param string $field
549 549
      * @param array $query
550 550
      * @param array $options
551 551
      * @return mixed
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
     /**
583 583
      * Return the min value for a field in a collection
584 584
      *
585
-     * @param $field
585
+     * @param string $field
586 586
      * @param array $query
587 587
      * @param array $options
588 588
      * @return \Traversable
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -5,8 +5,6 @@
 block discarded – undo
5 5
 
6 6
 use MongoDB\BulkWriteResult;
7 7
 use MongoDB\Collection;
8
-use MongoDB\Operation\InsertOne;
9
-use Psr\Log\LoggerInterface;
10 8
 use Psr\Log\NullLogger;
11 9
 use Pouzor\MongoDBBundle\Constants\DriverClasses;
12 10
 use Pouzor\MongoDBBundle\Constants\Query;
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
             if (preg_match($regex, $re->getMessage(), $output)) {
93 93
                 $name = $output['name'];
94 94
 
95
-                $this->logger->info('Dropping index ' . $name);
95
+                $this->logger->info('Dropping index '.$name);
96 96
                 $result = $this->collection->dropIndex($name);
97 97
 
98
-                $this->logger->info('Result from dropping index ' . $name, $result);
98
+                $this->logger->info('Result from dropping index '.$name, $result);
99 99
 
100 100
                 $this->ensureIndex($fields, $options, $callback);
101 101
             }
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
         $query = [$field => ['$gt' => $min, '$lte' => $max]];
520 520
 
521 521
         $this->logger->info(
522
-            'Counting  ' . $field,
522
+            'Counting  '.$field,
523 523
             [
524 524
                 'filter' => [
525 525
                     $field => ['$gt' => $min, '$lte' => $max]
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
             ]
576 576
         )->toArray();
577 577
 
578
-        return ArrayAccessor::dget($result, '0.' . $field);
578
+        return ArrayAccessor::dget($result, '0.'.$field);
579 579
 
580 580
     }
581 581
 
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
             ]
613 613
         )->toArray();
614 614
 
615
-        return ArrayAccessor::dget($result, '0.' . $field);
615
+        return ArrayAccessor::dget($result, '0.'.$field);
616 616
     }
617 617
 
618 618
     /**
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
     {
626 626
 
627 627
         $this->logger->info(
628
-            'Distinct over ' . $field,
628
+            'Distinct over '.$field,
629 629
             [
630 630
                 'filter' => $filter,
631 631
                 'options' => $options,
@@ -667,28 +667,28 @@  discard block
 block discarded – undo
667 667
          * limit
668 668
          */
669 669
         if (isset($options[Query::SORT]) and !is_array($options[Query::SORT])) {
670
-            throw new \InvalidArgumentException(Query::SORT . ' option must be an array');
670
+            throw new \InvalidArgumentException(Query::SORT.' option must be an array');
671 671
         }
672 672
 
673 673
         /**
674 674
          * limit
675 675
          */
676 676
         if (isset($options[Query::PROJECTION]) and !is_array($options[Query::PROJECTION])) {
677
-            throw new \InvalidArgumentException(Query::PROJECTION . ' option must be an array');
677
+            throw new \InvalidArgumentException(Query::PROJECTION.' option must be an array');
678 678
         }
679 679
 
680 680
         /**
681 681
          *  limit
682 682
          */
683 683
         if (isset($options[Query::LIMIT]) and !is_integer($options[Query::LIMIT])) {
684
-            throw new \InvalidArgumentException(Query::LIMIT . " option must be an integer");
684
+            throw new \InvalidArgumentException(Query::LIMIT." option must be an integer");
685 685
         }
686 686
 
687 687
         /**
688 688
          *  limit
689 689
          */
690 690
         if (isset($options[Query::OFFSET]) and !is_integer($options[Query::OFFSET])) {
691
-            throw new \InvalidArgumentException(Query::OFFSET . ' option must be an array');
691
+            throw new \InvalidArgumentException(Query::OFFSET.' option must be an array');
692 692
         }
693 693
 
694 694
         // TODO validate other options
Please login to merge, or discard this patch.
Services/ArrayAccessor.php 3 patches
Doc Comments   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
      * Replace an array key with another while keeping value
11 11
      *
12 12
      * @param array $array
13
-     * @param $key1
14
-     * @param $key2
13
+     * @param string $key1
14
+     * @param string $key2
15 15
      * @return array
16 16
      */
17 17
     static function replaceKey(&$array, $key1, $key2)
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
      * person.childs.0.name = victor
48 48
      *
49 49
      * @param array $data
50
-     * @param $path
51
-     * @param $default
50
+     * @param string $path
51
+     * @param string $default
52 52
      * @return array|null
53 53
      */
54 54
     static function dget(array &$data, $path, $default = null)
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
      *
86 86
      *
87 87
      * @param array $data
88
-     * @param $path
89
-     * @param $value
88
+     * @param string $path
89
+     * @param string $value
90 90
      */
91 91
     static function dset(array &$data, $path, $value)
92 92
     {
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      * person.childs = 2
124 124
      *
125 125
      * @param array $data
126
-     * @param $path
126
+     * @param string $path
127 127
      * @return int|null
128 128
      */
129 129
     static function dcount(array &$data, $path)
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      * )
172 172
      *
173 173
      * @param array $data
174
-     * @param $path
174
+     * @param string $path
175 175
      */
176 176
     static function ddel(array &$data, $path)
177 177
     {
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 
190 190
     /**
191 191
      * @param $array
192
-     * @param $key
193
-     * @param null $default
192
+     * @param string $key
193
+     * @param string $default
194 194
      * @return null
195 195
      */
196 196
     static function get_key_exist($array, $key, $default = null) {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         $keys = explode('.', $path);
57 57
         foreach ($keys as $k) {
58 58
             if (isset($data[$k])) {
59
-                $data =& $data[$k];
59
+                $data = & $data[$k];
60 60
             } else {
61 61
                 return $default;
62 62
             }
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
         $last = array_pop($keys);
95 95
         foreach ($keys as $k) {
96 96
             if (isset($data[$k]) && is_array($data[$k])) {
97
-                $data =& $data[$k];
97
+                $data = & $data[$k];
98 98
             } else {
99 99
                 $data[$k] = array();
100
-                $data =& $data[$k];
100
+                $data = & $data[$k];
101 101
             }
102 102
         }
103 103
         $data[$last] = $value;
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         $last = array_pop($keys);
133 133
         foreach ($keys as $k) {
134 134
             if (isset($data[$k]) && is_array($data[$k])) {
135
-                $data =& $data[$k];
135
+                $data = & $data[$k];
136 136
             } else {
137 137
                 return null;
138 138
             }
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
         $last = array_pop($keys);
180 180
         foreach ($keys as $k) {
181 181
             if (isset($data[$k]) && is_array($data[$k])) {
182
-                $data =& $data[$k];
182
+                $data = & $data[$k];
183 183
             } else {
184 184
                 return;
185 185
             }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -195,8 +195,9 @@
 block discarded – undo
195 195
      */
196 196
     static function get_key_exist($array, $key, $default = null) {
197 197
 
198
-        if (isset($array[$key]))
199
-            return $array[$key];
198
+        if (isset($array[$key])) {
199
+                    return $array[$key];
200
+        }
200 201
 
201 202
         return $default;
202 203
 
Please login to merge, or discard this patch.
Command/BuildIndexesCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 
39 39
         $manager = $this->getContainer()->get('document.manager');
40 40
 
41
-        $callback = function ($name) use ($style) {
41
+        $callback = function($name) use ($style) {
42 42
             $style->comment(sprintf('%s : Ok', $name));
43 43
         };
44 44
 
Please login to merge, or discard this patch.
DependencyInjection/Compiler/MongoTypeTransformer.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 
18 18
         $references = [];
19 19
 
20
-        foreach($ids as $id => $tags)
20
+        foreach ($ids as $id => $tags)
21 21
         {
22
-            foreach($tags as $tag => $attributes)
22
+            foreach ($tags as $tag => $attributes)
23 23
             {
24 24
                 $references[] = new Reference($id);
25 25
             }
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 
28 28
         $managers = $container->findTaggedServiceIds('document.manager');
29 29
 
30
-        foreach($managers as $id => $tags)
30
+        foreach ($managers as $id => $tags)
31 31
         {
32 32
             $def = $container->getDefinition($id);
33 33
 
34
-            foreach($references as $ref){
35
-                $def->addMethodCall('addTransformer', [ $ref]);
34
+            foreach ($references as $ref) {
35
+                $def->addMethodCall('addTransformer', [$ref]);
36 36
             }
37 37
         }
38 38
     }
Please login to merge, or discard this patch.
DependencyInjection/MongoDBExtension.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@
 block discarded – undo
31 31
             );
32 32
 
33 33
             $def = $container->register('document.manager.'.$name, DocumentManager::class);
34
-            $def->addTag('document.manager',[ 'name' => $name]);
34
+            $def->addTag('document.manager', ['name' => $name]);
35 35
             $def->setArguments([$con, new Reference('logger')]);
36
-            $def->addTag('monolog.logger', [ 'channel' => 'odm.mongo']);
36
+            $def->addTag('monolog.logger', ['channel' => 'odm.mongo']);
37 37
         }
38 38
 
39
-        if(isset($mergedConfig['default_connection']) and $container->hasDefinition('document.manager.'.$mergedConfig['default_connection'])){
39
+        if (isset($mergedConfig['default_connection']) and $container->hasDefinition('document.manager.'.$mergedConfig['default_connection'])) {
40 40
             $container->setAlias('document.manager', 'document.manager.'.$mergedConfig['default_connection']);
41 41
         }
42 42
     }
Please login to merge, or discard this patch.
DependencyInjection/Configuration.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
                                     ->beforeNormalization()
71 71
                                     // Handle readPreferenceTag XML nodes
72 72
                                     ->ifTrue(
73
-                                        function ($v) {
73
+                                        function($v) {
74 74
                                             return isset($v['readPreferenceTag']);
75 75
                                         }
76 76
                                     )
77 77
                                     ->then(
78
-                                        function ($v) {
78
+                                        function($v) {
79 79
                                             // Equivalent of fixXmlConfig() for inner node
80 80
                                             if (isset($v['readPreferenceTag']['name'])) {
81 81
                                                 $v['readPreferenceTag'] = array($v['readPreferenceTag']);
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
                     ->end()
98 98
                     ->validate()
99 99
                     ->ifTrue(
100
-                        function ($v) {
100
+                        function($v) {
101 101
                             return count($v['readPreferenceTags']) === 0;
102 102
                         }
103 103
                     )
104 104
                     ->then(
105
-                        function ($v) {
105
+                        function($v) {
106 106
                             unset($v['readPreferenceTags']);
107 107
 
108 108
                             return $v;
Please login to merge, or discard this patch.