Completed
Push — dev ( 5fa4ce...38580b )
by James Ekow Abaka
01:40
created
src/DataOperations.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         foreach ($relationshipsWithData as $model => $relationship) {
240 240
             $relationship->postSave($record);
241 241
             $invalidRelatedFields = $relationship->getInvalidFields();
242
-            if(!empty($invalidRelatedFields)) {
242
+            if (!empty($invalidRelatedFields)) {
243 243
                 $status['success'] = false;
244 244
                 $status['invalid_fields'][$model] = $invalidRelatedFields;
245 245
             }
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
             $mainValidatorErrors = $validator->getInvalidFields();
266 266
         }
267 267
 
268
-        if(!empty($this->wrapper->getValidationRules())) {
268
+        if (!empty($this->wrapper->getValidationRules())) {
269 269
             $modelValidator = new Validator();
270 270
             $modelValidator->setRules($this->wrapper->getValidationRules());
271
-            if(!$modelValidator->validate($data)) {
271
+            if (!$modelValidator->validate($data)) {
272 272
                 $modelValidatorErrors = $modelValidator->getInvalidFields();
273 273
             }
274 274
         }
Please login to merge, or discard this patch.
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@
 block discarded – undo
28 28
 
29 29
 use ntentan\atiaa\Driver;
30 30
 use ntentan\atiaa\exceptions\ConnectionException;
31
-use ntentan\utils\exceptions\ValidatorNotFoundException;
32 31
 use ntentan\utils\Validator;
32
+use ntentan\utils\exceptions\ValidatorNotFoundException;
33 33
 
34 34
 /**
35 35
  * Description of DataOperations.
Please login to merge, or discard this patch.
src/RecordWrapper.php 2 patches
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
      * Callback for when a new record has been created.
507 507
      * This callback can be most useful for obtaining the primary key of a newly created record.
508 508
      *
509
-     * @param $id
509
+     * @param string $id
510 510
      */
511 511
     public function postCreateCallback($id)
512 512
     {
@@ -550,6 +550,10 @@  discard block
 block discarded – undo
550 550
         return $this->adapter;
551 551
     }
552 552
 
553
+    /**
554
+     * @param Relationship[] $relationships
555
+     * @param integer $depth
556
+     */
553 557
     private function expandArrayValue($array, $relationships, $depth, $expandableModels = [], $index = null)
554 558
     {
555 559
         $allExpandableModels = empty($expandableModels) ? array_keys($relationships) : $expandableModels;
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
         $this->initialize();
212 212
 
213 213
         return $this->context->getCache()->read(
214
-            "{$this->className}::desc", function () {
214
+            "{$this->className}::desc", function() {
215 215
                 return $this->context->getModelDescription($this);
216 216
             }
217 217
         );
@@ -449,13 +449,13 @@  discard block
 block discarded – undo
449 449
             return null;
450 450
         }        
451 451
         $name = $relationship->getOptions()['name'];
452
-        if(isset($data[$name]))
452
+        if (isset($data[$name]))
453 453
         {
454 454
             return $data[$name];
455 455
         }
456 456
         $query = $relationship->prepareQuery($data);
457 457
 
458
-        if($query) {
458
+        if ($query) {
459 459
             $model = $relationship->getModelInstance();
460 460
             return $model->fetch($query);
461 461
         } else {
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
         $allExpandableModels = empty($expandableModels) ? array_keys($relationships) : $expandableModels;
556 556
         foreach ($allExpandableModels as $name) {
557 557
             $value = $this->fetchRelatedFields($relationships[$name], $index);
558
-            if($value) {
558
+            if ($value) {
559 559
                 $array[$name] = $value->toArray($depth, $expandableModels);
560 560
             } else {
561 561
                 $array[$name] = null;
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
     public function fromArray($data)
596 596
     {
597 597
         // Create a new instance if this model already has data.
598
-        if($this->hasDataBeenSet) {
598
+        if ($this->hasDataBeenSet) {
599 599
             $instance = new $this->className();
600 600
         } else {
601 601
             $instance = $this;
Please login to merge, or discard this patch.