Completed
Push — main ( 9780e3...89631d )
by James Ekow Abaka
22:53
created
src/RecordWrapper.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         $this->initialize();
190 190
 
191 191
         return $this->context->getCache()->read(
192
-            "{$this->className}::desc", function () {
192
+            "{$this->className}::desc", function() {
193 193
                 return $this->context->getModelDescription($this);
194 194
             }
195 195
         );
@@ -418,13 +418,13 @@  discard block
 block discarded – undo
418 418
             return null;
419 419
         }        
420 420
         $name = $relationship->getOptions()['name'];
421
-        if(isset($data[$name]))
421
+        if (isset($data[$name]))
422 422
         {
423 423
             return $data[$name];
424 424
         }
425 425
         $query = $relationship->prepareQuery($data);
426 426
 
427
-        if($query) {
427
+        if ($query) {
428 428
             $model = $relationship->getModelInstance();
429 429
             return $model->fetch($query);
430 430
         } else {
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
         $allExpandableModels = empty($expandableModels) ? array_keys($relationships) : $expandableModels;
523 523
         foreach ($allExpandableModels as $name) {
524 524
             $value = $this->fetchRelatedFields($relationships[$name], $index);
525
-            if($value) {
525
+            if ($value) {
526 526
                 $array[$name] = $value->toArray($depth, $expandableModels);
527 527
             } else {
528 528
                 $array[$name] = null;
@@ -559,10 +559,10 @@  discard block
 block discarded – undo
559 559
     /**
560 560
      * Return an instance of the model populated with array data.
561 561
      */
562
-    public function fromArray(array $data, bool $isFromQuery=false): RecordWrapper
562
+    public function fromArray(array $data, bool $isFromQuery = false): RecordWrapper
563 563
     {
564 564
         // Create a new instance if this model already has data.
565
-        if($this->hasDataBeenSet) {
565
+        if ($this->hasDataBeenSet) {
566 566
             $instance = new $this->className();
567 567
         } else {
568 568
             $instance = $this;
Please login to merge, or discard this patch.
src/DataOperations.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
         foreach ($relationshipsWithData as $model => $relationship) {
257 257
             $relationship->postSave($record);
258 258
             $invalidRelatedFields = $relationship->getInvalidFields();
259
-            if(!empty($invalidRelatedFields)) {
259
+            if (!empty($invalidRelatedFields)) {
260 260
                 $status['success'] = false;
261 261
                 $status['invalid_fields'][$model] = $invalidRelatedFields;
262 262
             }
@@ -284,10 +284,10 @@  discard block
 block discarded – undo
284 284
             $mainValidatorErrors = $validator->getInvalidFields();
285 285
         }
286 286
 
287
-        if(!empty($this->wrapper->getValidationRules())) {
287
+        if (!empty($this->wrapper->getValidationRules())) {
288 288
             $modelValidator = new Validator();
289 289
             $modelValidator->setRules($this->wrapper->getValidationRules());
290
-            if(!$modelValidator->validate($data)) {
290
+            if (!$modelValidator->validate($data)) {
291 291
                 $modelValidatorErrors = $modelValidator->getInvalidFields();
292 292
             }
293 293
         }
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
      *
305 305
      * @return bool
306 306
      */
307
-    private function isPrimaryKeySet(string|array $primaryKey, array $data) : bool
307
+    private function isPrimaryKeySet(string | array $primaryKey, array $data) : bool
308 308
     {
309 309
         if (is_string($primaryKey) && ($data[$primaryKey] !== null || $data[$primaryKey] !== '')) {
310 310
             return true;
Please login to merge, or discard this patch.