Passed
Pull Request — master (#81)
by
unknown
07:11 queued 03:21
created
src/Extensions/MongoCollection.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
                 return false;
19 19
             }
20 20
         })->first();
21
-        if (! $out) {//Handler 404 Object Not Found
21
+        if (!$out) {//Handler 404 Object Not Found
22 22
             $obj_name = get_class($this->first());
23 23
             $message = __('error.'.$obj_name);
24 24
             abort(404, $message);
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
                 return true;
41 41
             }
42 42
         })->first();
43
-        if (! $out) {//Handler 404 Object Not Found
43
+        if (!$out) {//Handler 404 Object Not Found
44 44
             $obj_name = get_class($this->first());
45 45
             $message = __('error.'.$obj_name);
46 46
             abort(404, $message);
Please login to merge, or discard this patch.
src/Console/DropCollection.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
         $model = $this->getModel($modelPath);
47 47
 
48
-        if (! is_null($model)) {
48
+        if (!is_null($model)) {
49 49
             $model = $model->all();
50 50
 
51 51
             $count = $model->count();
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
                 for ($i = 0; $i <= $count - 1; $i++) {
56 56
                     $bar->advance();
57 57
                     $model[$i]->destroyWithSync();
58
-                    $this->line($i + 1 .') Destroy item document with id #'.$model[$i]->getId());
58
+                    $this->line($i + 1.') Destroy item document with id #'.$model[$i]->getId());
59 59
                 }
60 60
             } else {
61 61
                 $this->warn('No record found on collection '.strtolower($collection_name));
Please login to merge, or discard this patch.
src/Traits/MainMongoTrait.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      */
120 120
     public function checkPropertyExistence($obj, string $EOkey, $method = '', $model = '')
121 121
     {
122
-        if (! property_exists($obj, $EOkey)) {
122
+        if (!property_exists($obj, $EOkey)) {
123 123
             $msg = 'Error - '.$EOkey.' attribute not found on obj '.json_encode($obj).' during save of model: '.$model.' and attribute: '.$method;
124 124
             throw new Exception($msg);
125 125
         }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
      */
133 133
     public function checkArrayExistence($arr, string $key)
134 134
     {
135
-        if (! Arr::has($arr, $key)) {
135
+        if (!Arr::has($arr, $key)) {
136 136
             $msg = ('Error - '.$key.' attribute not found on obj '.json_encode($arr));
137 137
             throw new Exception($msg);
138 138
         }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      */
146 146
     private function checkRequestExistence(Request $request, string $key)
147 147
     {
148
-        if (! $request->has($key)) {
148
+        if (!$request->has($key)) {
149 149
             $msg = ('Error - '.$key.' attribute not found in Request '.json_encode($request->all()));
150 150
             throw new Exception($msg);
151 151
         }
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      */
159 159
     public function getIsSkippable($request_has_key, $hasTarget = false)
160 160
     {
161
-        return ! $request_has_key && $this->getHasPartialRequest() && ! $hasTarget;
161
+        return !$request_has_key && $this->getHasPartialRequest() && !$hasTarget;
162 162
     }
163 163
 
164 164
     /**
Please login to merge, or discard this patch.
src/Traits/ModelAdditionalMethod.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function getMongoRelation(): array
34 34
     {
35
-        if (! empty($this->mongoRelation)) {
35
+        if (!empty($this->mongoRelation)) {
36 36
             return $this->mongoRelation;
37 37
         } else {
38 38
             return [];
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
         if ($is_EO) {
392 392
             $objs[] = $this->getObjValueToBeSaved($method, '', false);
393 393
         } elseif ($is_EM) {
394
-            if (! is_null($this->$method) > 0) {
394
+            if (!is_null($this->$method) > 0) {
395 395
                 foreach ($this->$method as $value) {
396 396
                     $obj = new stdClass;
397 397
                     $obj->ref_id = $value->ref_id;
Please login to merge, or discard this patch.
src/syncUtils.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 use Illuminate\Support\Facades\Config;
6 6
 use Jenssegers\Mongodb\Eloquent\Model;
7 7
 
8
-if (! function_exists('getTranslatedContent')) {
8
+if (!function_exists('getTranslatedContent')) {
9 9
 
10 10
     /**
11 11
      * @param  array  $mlCollection
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
         //Get current Lang
17 17
         $cl = Config::get('app.locale');
18 18
 
19
-        if (is_array($mlCollection) && (array_key_exists('en_EN', $mlCollection) || array_key_exists('it_IT', $mlCollection) || ! is_null($mlCollection || ! isset($destination)))) {
19
+        if (is_array($mlCollection) && (array_key_exists('en_EN', $mlCollection) || array_key_exists('it_IT', $mlCollection) || !is_null($mlCollection || !isset($destination)))) {
20 20
             return $mlCollection[$cl];
21 21
         } else {
22 22
             return '';
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     }
25 25
 }
26 26
 
27
-if (! function_exists('cl')) {
27
+if (!function_exists('cl')) {
28 28
 
29 29
     /**
30 30
      * @return string current Lang
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     }
37 37
 }
38 38
 
39
-if (! function_exists('ml')) {
39
+if (!function_exists('ml')) {
40 40
     //save a localized field
41 41
     /**
42 42
      * @param  array  $destination
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     }
54 54
 }
55 55
 
56
-if (! function_exists('isML')) {
56
+if (!function_exists('isML')) {
57 57
     function isML($value)
58 58
     {
59 59
         if (array_key_exists('is-ml', $value)) {
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     }
65 65
 }
66 66
 
67
-if (! function_exists('isMD')) {
67
+if (!function_exists('isMD')) {
68 68
     function isMD($value)
69 69
     {
70 70
         if (array_key_exists('is-md', $value)) {
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     }
76 76
 }
77 77
 
78
-if (! function_exists('is_EM')) {
78
+if (!function_exists('is_EM')) {
79 79
     function is_EM($value)
80 80
     {
81 81
         if ($value === 'EmbedsMany') {
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     }
87 87
 }
88 88
 
89
-if (! function_exists('is_EO')) {
89
+if (!function_exists('is_EO')) {
90 90
     function is_EO($value)
91 91
     {
92 92
         if ($value === 'EmbedsOne') {
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     }
98 98
 }
99 99
 
100
-if (! function_exists('is_HM')) {
100
+if (!function_exists('is_HM')) {
101 101
     function is_HM($value)
102 102
     {
103 103
         if ($value === 'HasMany') {
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     }
109 109
 }
110 110
 
111
-if (! function_exists('is_HO')) {
111
+if (!function_exists('is_HO')) {
112 112
     function is_HO($value)
113 113
     {
114 114
         if ($value === 'HasOne') {
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     }
120 120
 }
121 121
 
122
-if (! function_exists('isEditable')) {
122
+if (!function_exists('isEditable')) {
123 123
     function isEditable($value)
124 124
     {
125 125
         if (array_key_exists('is-editable', $value)) {
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     }
131 131
 }
132 132
 
133
-if (! function_exists('hasTarget')) {
133
+if (!function_exists('hasTarget')) {
134 134
     function hasTarget($value)
135 135
     {
136 136
         if (array_key_exists('has-target', $value)) {
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     }
142 142
 }
143 143
 
144
-if (! function_exists('isFillable')) {
144
+if (!function_exists('isFillable')) {
145 145
     function isFillable($value, $event)
146 146
     {
147 147
         if ($event === 'add') {
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
     }
153 153
 }
154 154
 
155
-if (! function_exists('getAID')) {
155
+if (!function_exists('getAID')) {
156 156
     /**
157 157
      * @param  Model  $model
158 158
      * @return string
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     }
167 167
 }
168 168
 
169
-if (! function_exists('getArrayWithEmptyObj')) {
169
+if (!function_exists('getArrayWithEmptyObj')) {
170 170
 
171 171
     /**
172 172
      * @param $model
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     }
193 193
 }
194 194
 
195
-if (! function_exists('getCounterForRelationships')) {
195
+if (!function_exists('getCounterForRelationships')) {
196 196
 
197 197
     /**
198 198
      * @param $method
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         }
211 211
     }
212 212
 
213
-    if (! function_exists('getTypeOnTarget')) {
213
+    if (!function_exists('getTypeOnTarget')) {
214 214
         function getTypeOnTarget($relation)
215 215
         {
216 216
             return Arr::has($relation, 'typeOnTarget') ? Arr::get($relation, 'typeOnTarget') : 'EmbedsMany';
Please login to merge, or discard this patch.
src/Traits/RelationshipMongoTrait.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
             $is_embeds_has_to_be_updated = $request->has($key);
67 67
 
68
-            if (! is_null($value) && ! ($value == '') && ! ($value == '[]')) {
68
+            if (!is_null($value) && !($value == '') && !($value == '[]')) {
69 69
                 $objs = json_decode($value);
70 70
             } else {
71 71
                 $objs = getArrayWithEmptyObj($model, $is_EO, $is_EM);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
                     }
86 86
                 }
87 87
 
88
-                if (! empty($objs)) {
88
+                if (!empty($objs)) {
89 89
                     if ($is_EM) {
90 90
                         $this->tempEM = [];
91 91
                     }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         if ($is_EM_target) {
137 137
             $new_values = [];
138 138
             throw_if(
139
-                ! isset($this->$method_on_target),
139
+                !isset($this->$method_on_target),
140 140
                 new Exception(
141 141
                     'Error during target update. Remember to init the attribute '.$method_on_target.
142 142
                     ' on collection '.$this->getCollection()
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                     )
154 154
                 );
155 155
 
156
-                if (! is_null($temp)) {
156
+                if (!is_null($temp)) {
157 157
                     if ($this->getIsPartialRequest()) {
158 158
                         if (Arr::get($temp->attributes, 'ref_id') !== Arr::get($mini_model->attributes, 'ref_id')) {
159 159
                             $new_values[] = $temp->attributes;
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
                 }
168 168
             }
169 169
 
170
-            if (! $is_update_operation) {
170
+            if (!$is_update_operation) {
171 171
                 $new_values[] = $mini_model->attributes;
172 172
             }
173 173
         } elseif ($is_EO_target) {
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     {
231 231
         if ($is_EO) {
232 232
             $embedObj = $this->$method;
233
-            if (! is_null($embedObj)) {
233
+            if (!is_null($embedObj)) {
234 234
                 $target_id = $embedObj->ref_id;
235 235
                 $this->handleSubTarget($target_id, $modelTarget, $methodOnTarget, $is_EO_target, $is_EM_target);
236 236
             }
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         if ($is_EM_target) {
254 254
             $target = new $modelTarget;
255 255
             $target = $target->all()->where('id', $target_id)->first();
256
-            if (! is_null($target)) {
256
+            if (!is_null($target)) {
257 257
                 $new_values = [];
258 258
                 foreach ($target->$methodOnTarget as $temp) {
259 259
                     if ($temp->ref_id !== $this->getId()) {
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
         $EOitems = $embedObj->getItems();
291 291
         //Current Obj Create
292 292
         foreach ($EOitems as $EOkey => $item) {
293
-            if (! is_null($obj)) {
293
+            if (!is_null($obj)) {
294 294
                 $is_ML = isML($item);
295 295
                 $is_MD = isMD($item);
296 296
                 $this->checkPropertyExistence($obj, $EOkey, $method, $model);
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
     private function processEmbedOnTargetCollection($modelTarget, $obj, $methodOnTarget, $modelOnTarget, bool $is_EO_target, bool $is_EM_target)
341 341
     {
342 342
         $modelToBeSync = $this->getModelTobeSync($modelTarget, $obj);
343
-        if (! is_null($modelToBeSync)) {
343
+        if (!is_null($modelToBeSync)) {
344 344
             $miniModel = $this->getEmbedModel($modelOnTarget);
345 345
             $modelToBeSync->setIsPartialRequest([], $this->getIsPartialRequest());
346 346
             $modelToBeSync->updateRelationWithSync($miniModel, $methodOnTarget, $is_EO_target, $is_EM_target);
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 
357 357
     public function setIsPartialRequest(array $options, $is_partial_request = null): void
358 358
     {
359
-        if (! is_null($is_partial_request)) {
359
+        if (!is_null($is_partial_request)) {
360 360
             $this->is_partial_request = $is_partial_request;
361 361
 
362 362
             return;
Please login to merge, or discard this patch.