@@ -18,7 +18,7 @@ discard block |
||
| 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 |
||
| 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); |
@@ -45,7 +45,7 @@ discard block |
||
| 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 |
||
| 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)); |
@@ -119,7 +119,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | /** |
@@ -32,7 +32,7 @@ discard block |
||
| 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 |
||
| 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; |
@@ -5,7 +5,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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)) { |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | -if (! function_exists('is_EM')) { |
|
| 77 | +if (!function_exists('is_EM')) { |
|
| 78 | 78 | function is_EM($value) |
| 79 | 79 | { |
| 80 | 80 | if ($value === 'EmbedsMany') { |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | -if (! function_exists('is_EO')) { |
|
| 88 | +if (!function_exists('is_EO')) { |
|
| 89 | 89 | function is_EO($value) |
| 90 | 90 | { |
| 91 | 91 | if ($value === 'EmbedsOne') { |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | -if (! function_exists('is_HM')) { |
|
| 99 | +if (!function_exists('is_HM')) { |
|
| 100 | 100 | function is_HM($value) |
| 101 | 101 | { |
| 102 | 102 | if ($value === 'HasMany') { |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | -if (! function_exists('is_HO')) { |
|
| 110 | +if (!function_exists('is_HO')) { |
|
| 111 | 111 | function is_HO($value) |
| 112 | 112 | { |
| 113 | 113 | if ($value === 'HasOne') { |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | -if (! function_exists('isEditable')) { |
|
| 121 | +if (!function_exists('isEditable')) { |
|
| 122 | 122 | function isEditable($value) |
| 123 | 123 | { |
| 124 | 124 | if (array_key_exists('is-editable', $value)) { |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | -if (! function_exists('hasTarget')) { |
|
| 132 | +if (!function_exists('hasTarget')) { |
|
| 133 | 133 | function hasTarget($value) |
| 134 | 134 | { |
| 135 | 135 | if (array_key_exists('has-target', $value)) { |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | -if (! function_exists('isFillable')) { |
|
| 142 | +if (!function_exists('isFillable')) { |
|
| 143 | 143 | function isFillable($value, $event) |
| 144 | 144 | { |
| 145 | 145 | if ($event === 'add') { |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | -if (! function_exists('getRequestToBeSync')) { |
|
| 153 | +if (!function_exists('getRequestToBeSync')) { |
|
| 154 | 154 | /** |
| 155 | 155 | * @param $ref_id |
| 156 | 156 | * @param $modelOnTarget |
@@ -180,14 +180,14 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | -if (! function_exists('getPrimaryRequest')) { |
|
| 183 | +if (!function_exists('getPrimaryRequest')) { |
|
| 184 | 184 | /** |
| 185 | 185 | * @param string $request |
| 186 | 186 | * @return string |
| 187 | 187 | */ |
| 188 | 188 | function getPrimaryRequest($request) |
| 189 | 189 | { |
| 190 | - if (! is_null($request)) { |
|
| 190 | + if (!is_null($request)) { |
|
| 191 | 191 | $arr = []; |
| 192 | 192 | $categorylistdataJson = $request; |
| 193 | 193 | $categorylistdataArr = json_decode($categorylistdataJson); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | -if (! function_exists('getAID')) { |
|
| 209 | +if (!function_exists('getAID')) { |
|
| 210 | 210 | /** |
| 211 | 211 | * @param Model $model |
| 212 | 212 | * @return string |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | } |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | -if (! function_exists('isRequestReadyToBeProcessed')) { |
|
| 223 | +if (!function_exists('isRequestReadyToBeProcessed')) { |
|
| 224 | 224 | function isRequestReadyToBeProcessed(Request $request) |
| 225 | 225 | { |
| 226 | 226 | $requests = $request->all(); |
@@ -237,14 +237,14 @@ discard block |
||
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | -if (! function_exists('removeSubCollectionInput')) { |
|
| 240 | +if (!function_exists('removeSubCollectionInput')) { |
|
| 241 | 241 | function removeSubCollectionInput(Request $request) |
| 242 | 242 | { |
| 243 | 243 | return $request; |
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | -if (! function_exists('prepareRequest')) { |
|
| 247 | +if (!function_exists('prepareRequest')) { |
|
| 248 | 248 | |
| 249 | 249 | /** |
| 250 | 250 | * @param Request $request |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | -if (! function_exists('getArrayWithEmptyObj')) { |
|
| 268 | +if (!function_exists('getArrayWithEmptyObj')) { |
|
| 269 | 269 | |
| 270 | 270 | /** |
| 271 | 271 | * @param $model |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | -if (! function_exists('getCounterForRelationships')) { |
|
| 294 | +if (!function_exists('getCounterForRelationships')) { |
|
| 295 | 295 | |
| 296 | 296 | /** |
| 297 | 297 | * @param $method |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | - if (! function_exists('getTypeOnTarget')) { |
|
| 312 | + if (!function_exists('getTypeOnTarget')) { |
|
| 313 | 313 | function getTypeOnTarget($relation) |
| 314 | 314 | { |
| 315 | 315 | return Arr::has($relation, 'typeOnTarget') ? Arr::get($relation, 'typeOnTarget') : 'EmbedsMany'; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | $is_embeds_has_to_be_updated = $request->has($key); |
| 63 | 63 | |
| 64 | - if (! is_null($value) && ! ($value == '') && ! ($value == '[]')) { |
|
| 64 | + if (!is_null($value) && !($value == '') && !($value == '[]')) { |
|
| 65 | 65 | $objs = json_decode($value); |
| 66 | 66 | } else { |
| 67 | 67 | $objs = getArrayWithEmptyObj($model, $is_EO, $is_EM); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - if (! empty($objs)) { |
|
| 84 | + if (!empty($objs)) { |
|
| 85 | 85 | if ($is_EM) { |
| 86 | 86 | $this->tempEM = []; |
| 87 | 87 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | if ($is_EM_target) { |
| 133 | 133 | $new_values = []; |
| 134 | 134 | throw_if( |
| 135 | - ! isset($this->$method_on_target), |
|
| 135 | + !isset($this->$method_on_target), |
|
| 136 | 136 | new Exception( |
| 137 | 137 | 'Error during target update. Remember to init the attribute '.$method_on_target. |
| 138 | 138 | ' on collection '.$this->getCollection() |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | 'EmbedsMany relationship on model '.get_class($this) |
| 147 | 147 | ) |
| 148 | 148 | ); |
| 149 | - if (! is_null($temp)) { |
|
| 149 | + if (!is_null($temp)) { |
|
| 150 | 150 | $new_values[] = $temp->attributes; |
| 151 | 151 | } |
| 152 | 152 | } |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | { |
| 212 | 212 | if ($is_EO) { |
| 213 | 213 | $embedObj = $this->$method; |
| 214 | - if (! is_null($embedObj)) { |
|
| 214 | + if (!is_null($embedObj)) { |
|
| 215 | 215 | $target_id = $embedObj->ref_id; |
| 216 | 216 | $this->handleSubTarget($target_id, $modelTarget, $methodOnTarget, $is_EO_target, $is_EM_target); |
| 217 | 217 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | if ($is_EM_target) { |
| 235 | 235 | $target = new $modelTarget; |
| 236 | 236 | $target = $target->all()->where('id', $target_id)->first(); |
| 237 | - if (! is_null($target)) { |
|
| 237 | + if (!is_null($target)) { |
|
| 238 | 238 | $new_values = []; |
| 239 | 239 | foreach ($target->$methodOnTarget as $temp) { |
| 240 | 240 | if ($temp->ref_id !== $this->getId()) { |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | $EOitems = $embedObj->getItems(); |
| 272 | 272 | //Current Obj Create |
| 273 | 273 | foreach ($EOitems as $EOkey => $item) { |
| 274 | - if (! is_null($obj)) { |
|
| 274 | + if (!is_null($obj)) { |
|
| 275 | 275 | $is_ML = isML($item); |
| 276 | 276 | $is_MD = isMD($item); |
| 277 | 277 | $this->checkPropertyExistence($obj, $EOkey, $method, $model); |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | private function processEmbedOnTargetCollection($modelTarget, $obj, $methodOnTarget, $modelOnTarget, bool $is_EO_target, bool $is_EM_target) |
| 322 | 322 | { |
| 323 | 323 | $modelToBeSync = $this->getModelTobeSync($modelTarget, $obj); |
| 324 | - if (! is_null($modelToBeSync)) { |
|
| 324 | + if (!is_null($modelToBeSync)) { |
|
| 325 | 325 | $miniModel = $this->getEmbedModel($modelOnTarget); |
| 326 | 326 | $modelToBeSync->updateRelationWithSync($miniModel, $methodOnTarget, $is_EO_target, $is_EM_target); |
| 327 | 327 | //TODO:Sync target on level > 1 |