@@ -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; |
@@ -65,7 +65,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -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 | * @param array $mlCollection |
| 10 | 10 | * @return string |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | //Get current Lang |
| 15 | 15 | $cl = Config::get('app.locale'); |
| 16 | 16 | |
| 17 | - if (is_array($mlCollection) && (array_key_exists('en_EN', $mlCollection) || array_key_exists('it_IT', $mlCollection) || ! is_null($mlCollection || ! isset($destination)))) { |
|
| 17 | + if (is_array($mlCollection) && (array_key_exists('en_EN', $mlCollection) || array_key_exists('it_IT', $mlCollection) || !is_null($mlCollection || !isset($destination)))) { |
|
| 18 | 18 | return $mlCollection[$cl]; |
| 19 | 19 | } else { |
| 20 | 20 | return ''; |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | -if (! function_exists('cl')) { |
|
| 25 | +if (!function_exists('cl')) { |
|
| 26 | 26 | /** |
| 27 | 27 | * @return string current Lang |
| 28 | 28 | */ |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | -if (! function_exists('ml')) { |
|
| 36 | +if (!function_exists('ml')) { |
|
| 37 | 37 | //save a localized field |
| 38 | 38 | /** |
| 39 | 39 | * @param array $destination |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | -if (! function_exists('isML')) { |
|
| 53 | +if (!function_exists('isML')) { |
|
| 54 | 54 | function isML($value) |
| 55 | 55 | { |
| 56 | 56 | if (array_key_exists('is-ml', $value)) { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | -if (! function_exists('isMD')) { |
|
| 64 | +if (!function_exists('isMD')) { |
|
| 65 | 65 | function isMD($value) |
| 66 | 66 | { |
| 67 | 67 | if (array_key_exists('is-md', $value)) { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | -if (! function_exists('is_EM')) { |
|
| 75 | +if (!function_exists('is_EM')) { |
|
| 76 | 76 | function is_EM($value) |
| 77 | 77 | { |
| 78 | 78 | if ($value === 'EmbedsMany') { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | -if (! function_exists('is_EO')) { |
|
| 86 | +if (!function_exists('is_EO')) { |
|
| 87 | 87 | function is_EO($value) |
| 88 | 88 | { |
| 89 | 89 | if ($value === 'EmbedsOne') { |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | -if (! function_exists('is_HM')) { |
|
| 97 | +if (!function_exists('is_HM')) { |
|
| 98 | 98 | function is_HM($value) |
| 99 | 99 | { |
| 100 | 100 | if ($value === 'HasMany') { |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | -if (! function_exists('is_HO')) { |
|
| 108 | +if (!function_exists('is_HO')) { |
|
| 109 | 109 | function is_HO($value) |
| 110 | 110 | { |
| 111 | 111 | if ($value === 'HasOne') { |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | -if (! function_exists('isEditable')) { |
|
| 119 | +if (!function_exists('isEditable')) { |
|
| 120 | 120 | function isEditable($value) |
| 121 | 121 | { |
| 122 | 122 | if (array_key_exists('is-editable', $value)) { |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | -if (! function_exists('hasTarget')) { |
|
| 130 | +if (!function_exists('hasTarget')) { |
|
| 131 | 131 | function hasTarget($value) |
| 132 | 132 | { |
| 133 | 133 | if (array_key_exists('has-target', $value)) { |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | -if (! function_exists('isFillable')) { |
|
| 141 | +if (!function_exists('isFillable')) { |
|
| 142 | 142 | function isFillable($value, $event) |
| 143 | 143 | { |
| 144 | 144 | if ($event === 'add') { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | -if (! function_exists('getAID')) { |
|
| 152 | +if (!function_exists('getAID')) { |
|
| 153 | 153 | /** |
| 154 | 154 | * @param Model $model |
| 155 | 155 | * @return string |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | -if (! function_exists('getArrayWithEmptyObj')) { |
|
| 166 | +if (!function_exists('getArrayWithEmptyObj')) { |
|
| 167 | 167 | /** |
| 168 | 168 | * @param $model |
| 169 | 169 | * @return array |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | -if (! function_exists('getCounterForRelationships')) { |
|
| 191 | +if (!function_exists('getCounterForRelationships')) { |
|
| 192 | 192 | /** |
| 193 | 193 | * @param $method |
| 194 | 194 | * @param $is_EO |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - if (! function_exists('getTypeOnTarget')) { |
|
| 208 | + if (!function_exists('getTypeOnTarget')) { |
|
| 209 | 209 | function getTypeOnTarget($relation) |
| 210 | 210 | { |
| 211 | 211 | return Arr::has($relation, 'typeOnTarget') ? Arr::get($relation, 'typeOnTarget') : 'EmbedsMany'; |