Test Failed
Pull Request — master (#74)
by
unknown
03:51
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   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
             $is_embeds_has_to_be_updated = $request->has($key);
64 64
 
65
-            if (! is_null($value) && ! ($value == '') && ! ($value == '[]')) {
65
+            if (!is_null($value) && !($value == '') && !($value == '[]')) {
66 66
                 $objs = json_decode($value);
67 67
             } else {
68 68
                 $objs = getArrayWithEmptyObj($model, $is_EO, $is_EM);
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
                     }
83 83
                 }
84 84
 
85
-                if (! empty($objs)) {
85
+                if (!empty($objs)) {
86 86
                     if ($is_EM) {
87 87
                         $this->tempEM = [];
88 88
                     }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         if ($is_EM_target) {
134 134
             $new_values = [];
135 135
             throw_if(
136
-                ! isset($this->$method_on_target),
136
+                !isset($this->$method_on_target),
137 137
                 new Exception(
138 138
                     'Error during target update. Remember to init the attribute '.$method_on_target.
139 139
                     ' on collection '.$this->getCollection()
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
     {
224 224
         if ($is_EO) {
225 225
             $embedObj = $this->$method;
226
-            if (! is_null($embedObj)) {
226
+            if (!is_null($embedObj)) {
227 227
                 $target_id = $embedObj->ref_id;
228 228
                 $this->handleSubTarget($target_id, $modelTarget, $methodOnTarget, $is_EO_target, $is_EM_target);
229 229
             }
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         if ($is_EM_target) {
247 247
             $target = new $modelTarget;
248 248
             $target = $target->all()->where('id', $target_id)->first();
249
-            if (! is_null($target)) {
249
+            if (!is_null($target)) {
250 250
                 $new_values = [];
251 251
                 foreach ($target->$methodOnTarget as $temp) {
252 252
                     if ($temp->ref_id !== $this->getId()) {
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
         $EOitems = $embedObj->getItems();
284 284
         //Current Obj Create
285 285
         foreach ($EOitems as $EOkey => $item) {
286
-            if (! is_null($obj)) {
286
+            if (!is_null($obj)) {
287 287
                 $is_ML = isML($item);
288 288
                 $is_MD = isMD($item);
289 289
                 $this->checkPropertyExistence($obj, $EOkey, $method, $model);
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
     private function processEmbedOnTargetCollection($modelTarget, $obj, $methodOnTarget, $modelOnTarget, bool $is_EO_target, bool $is_EM_target)
334 334
     {
335 335
         $modelToBeSync = $this->getModelTobeSync($modelTarget, $obj);
336
-        if (! is_null($modelToBeSync)) {
336
+        if (!is_null($modelToBeSync)) {
337 337
             $miniModel = $this->getEmbedModel($modelOnTarget);
338 338
             $modelToBeSync->updateRelationWithSync($miniModel, $methodOnTarget, $is_EO_target, $is_EM_target);
339 339
             //TODO:Sync target on level > 1
Please login to merge, or discard this patch.