@@ -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 []; |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | $obj->ref_id = $this->getObjValueToBeSaved($method, '', false); |
| 394 | 394 | $objs[] = $obj; |
| 395 | 395 | } elseif ($is_EM) { |
| 396 | - if (! is_null($this->$method) > 0) { |
|
| 396 | + if (!is_null($this->$method) > 0) { |
|
| 397 | 397 | foreach ($this->$method as $value) { |
| 398 | 398 | $obj = new stdClass; |
| 399 | 399 | $obj->ref_id = $value->ref_id; |
@@ -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); |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | use Illuminate\Support\Facades\Config; |
| 5 | 5 | use Jenssegers\Mongodb\Eloquent\Model; |
| 6 | 6 | |
| 7 | -if (! function_exists('getTranslatedContent')) { |
|
| 7 | +if (!function_exists('getTranslatedContent')) { |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * @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 |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | -if (! function_exists('isML')) { |
|
| 57 | +if (!function_exists('isML')) { |
|
| 58 | 58 | function isML($value) |
| 59 | 59 | { |
| 60 | 60 | try { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | -if (! function_exists('isMD')) { |
|
| 76 | +if (!function_exists('isMD')) { |
|
| 77 | 77 | function isMD($value) |
| 78 | 78 | { |
| 79 | 79 | if (array_key_exists('is-md', $value)) { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | -if (! function_exists('is_EM')) { |
|
| 86 | +if (!function_exists('is_EM')) { |
|
| 87 | 87 | function is_EM($value) |
| 88 | 88 | { |
| 89 | 89 | if ($value === 'EmbedsMany') { |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | -if (! function_exists('is_EO')) { |
|
| 97 | +if (!function_exists('is_EO')) { |
|
| 98 | 98 | function is_EO($value) |
| 99 | 99 | { |
| 100 | 100 | if ($value === 'EmbedsOne') { |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | -if (! function_exists('is_HM')) { |
|
| 108 | +if (!function_exists('is_HM')) { |
|
| 109 | 109 | function is_HM($value) |
| 110 | 110 | { |
| 111 | 111 | if ($value === 'HasMany') { |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | -if (! function_exists('is_HO')) { |
|
| 119 | +if (!function_exists('is_HO')) { |
|
| 120 | 120 | function is_HO($value) |
| 121 | 121 | { |
| 122 | 122 | if ($value === 'HasOne') { |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | -if (! function_exists('isEditable')) { |
|
| 130 | +if (!function_exists('isEditable')) { |
|
| 131 | 131 | function isEditable($value) |
| 132 | 132 | { |
| 133 | 133 | if (array_key_exists('is-editable', $value)) { |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | -if (! function_exists('hasTarget')) { |
|
| 141 | +if (!function_exists('hasTarget')) { |
|
| 142 | 142 | function hasTarget($value) |
| 143 | 143 | { |
| 144 | 144 | if (array_key_exists('has-target', $value)) { |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | -if (! function_exists('isFillable')) { |
|
| 151 | +if (!function_exists('isFillable')) { |
|
| 152 | 152 | function isFillable($value, $event) |
| 153 | 153 | { |
| 154 | 154 | if ($event === 'add') { |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | -if (! function_exists('getRequestToBeSync')) { |
|
| 162 | +if (!function_exists('getRequestToBeSync')) { |
|
| 163 | 163 | /** |
| 164 | 164 | * @param $ref_id |
| 165 | 165 | * @param $modelOnTarget |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | -if (! function_exists('getPrimaryRequest')) { |
|
| 193 | +if (!function_exists('getPrimaryRequest')) { |
|
| 194 | 194 | /** |
| 195 | 195 | * @param string $request |
| 196 | 196 | * |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | */ |
| 199 | 199 | function getPrimaryRequest($request) |
| 200 | 200 | { |
| 201 | - if (! is_null($request)) { |
|
| 201 | + if (!is_null($request)) { |
|
| 202 | 202 | $arr = []; |
| 203 | 203 | $categorylistdataJson = $request; |
| 204 | 204 | $categorylistdataArr = json_decode($categorylistdataJson); |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | -if (! function_exists('getAID')) { |
|
| 220 | +if (!function_exists('getAID')) { |
|
| 221 | 221 | /** |
| 222 | 222 | * @param Model $model |
| 223 | 223 | * @return string |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | -if (! function_exists('processList')) { |
|
| 234 | +if (!function_exists('processList')) { |
|
| 235 | 235 | /** |
| 236 | 236 | * @param array $array |
| 237 | 237 | * |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | -if (! function_exists('isRequestReadyToBeProcessed')) { |
|
| 258 | +if (!function_exists('isRequestReadyToBeProcessed')) { |
|
| 259 | 259 | function isRequestReadyToBeProcessed(Request $request) |
| 260 | 260 | { |
| 261 | 261 | $requests = $request->all(); |
@@ -272,14 +272,14 @@ discard block |
||
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | -if (! function_exists('removeSubCollectionInput')) { |
|
| 275 | +if (!function_exists('removeSubCollectionInput')) { |
|
| 276 | 276 | function removeSubCollectionInput(Request $request) |
| 277 | 277 | { |
| 278 | 278 | return $request; |
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | -if (! function_exists('prepareRequest')) { |
|
| 282 | +if (!function_exists('prepareRequest')) { |
|
| 283 | 283 | |
| 284 | 284 | /** |
| 285 | 285 | * @param Request $request |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | } |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | -if (! function_exists('getArrayWithEmptyObj')) { |
|
| 304 | +if (!function_exists('getArrayWithEmptyObj')) { |
|
| 305 | 305 | |
| 306 | 306 | /** |
| 307 | 307 | * @param $model |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | } |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | -if (! function_exists('getCounterForRelationships')) { |
|
| 331 | +if (!function_exists('getCounterForRelationships')) { |
|
| 332 | 332 | |
| 333 | 333 | /** |
| 334 | 334 | * @param $method |
@@ -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)); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | $is_embeds_has_to_be_updated = $request->has($key); |
| 143 | 143 | |
| 144 | - if (! is_null($value) && ! ($value == '') && ! ($value == '[]')) { |
|
| 144 | + if (!is_null($value) && !($value == '') && !($value == '[]')) { |
|
| 145 | 145 | $objs = json_decode($value); |
| 146 | 146 | } else { |
| 147 | 147 | $objs = getArrayWithEmptyObj($model, $is_EO, $is_EM); |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - if (! empty($objs)) { |
|
| 164 | + if (!empty($objs)) { |
|
| 165 | 165 | if ($is_EM) { |
| 166 | 166 | $this->tempEM = []; |
| 167 | 167 | } |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | { |
| 285 | 285 | if ($is_EO) { |
| 286 | 286 | $embedObj = $this->$method; |
| 287 | - if (! is_null($embedObj)) { |
|
| 287 | + if (!is_null($embedObj)) { |
|
| 288 | 288 | $target_id = $embedObj->ref_id; |
| 289 | 289 | $this->handleSubTarget($target_id, $modelTarget, $methodOnTarget, $is_EO_target, $is_EM_target); |
| 290 | 290 | } |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | if ($is_EM_target) { |
| 308 | 308 | $target = new $modelTarget; |
| 309 | 309 | $target = $target->all()->where('id', $target_id)->first(); |
| 310 | - if (! is_null($target)) { |
|
| 310 | + if (!is_null($target)) { |
|
| 311 | 311 | $new_values = []; |
| 312 | 312 | foreach ($target->$methodOnTarget as $temp) { |
| 313 | 313 | if ($temp->ref_id !== $this->getId()) { |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | */ |
| 383 | 383 | public function checkPropertyExistence($obj, string $EOkey, $method = '', $model = '') |
| 384 | 384 | { |
| 385 | - if (! property_exists($obj, $EOkey)) { |
|
| 385 | + if (!property_exists($obj, $EOkey)) { |
|
| 386 | 386 | $msg = 'Error - '.$EOkey.' attribute not found on obj '.json_encode($obj).' during save of model: '.$model.' and attribute: '.$method; |
| 387 | 387 | throw new Exception($msg); |
| 388 | 388 | } |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | */ |
| 396 | 396 | public function checkArrayExistence($arr, string $key) |
| 397 | 397 | { |
| 398 | - if (! Arr::has($arr, $key)) { |
|
| 398 | + if (!Arr::has($arr, $key)) { |
|
| 399 | 399 | $msg = ('Error - '.$key.' attribute not found on obj '.json_encode($arr)); |
| 400 | 400 | throw new Exception($msg); |
| 401 | 401 | } |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | */ |
| 409 | 409 | private function checkRequestExistence(Request $request, string $key) |
| 410 | 410 | { |
| 411 | - if (! $request->has($key)) { |
|
| 411 | + if (!$request->has($key)) { |
|
| 412 | 412 | $msg = ('Error - '.$key.' attribute not found in Request '.json_encode($request->all())); |
| 413 | 413 | throw new Exception($msg); |
| 414 | 414 | } |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | */ |
| 422 | 422 | public function getIsSkippable($request_has_key, $hasTarget = false) |
| 423 | 423 | { |
| 424 | - return ! $request_has_key && $this->getHasPartialRequest() && ! $hasTarget; |
|
| 424 | + return !$request_has_key && $this->getHasPartialRequest() && !$hasTarget; |
|
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | /** |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | $EOitems = $embedObj->getItems(); |
| 462 | 462 | //Current Obj Create |
| 463 | 463 | foreach ($EOitems as $EOkey => $item) { |
| 464 | - if (! is_null($obj)) { |
|
| 464 | + if (!is_null($obj)) { |
|
| 465 | 465 | $is_ML = isML($item); |
| 466 | 466 | $is_MD = isMD($item); |
| 467 | 467 | $this->checkPropertyExistence($obj, $EOkey, $method, $model); |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | private function processEmbedOnTargetCollection($modelTarget, $obj, $methodOnTarget, $modelOnTarget, $is_EO_target, $is_EM_target) |
| 511 | 511 | { |
| 512 | 512 | $modelToBeSync = $this->getModelTobeSync($modelTarget, $obj); |
| 513 | - if (! is_null($modelToBeSync)) { |
|
| 513 | + if (!is_null($modelToBeSync)) { |
|
| 514 | 514 | $miniModel = $this->getEmbedModel($modelOnTarget); |
| 515 | 515 | $modelToBeSync->updateRelationWithSync($miniModel, $methodOnTarget, $is_EO_target, $is_EM_target); |
| 516 | 516 | //TODO:Sync target on level > 1 |