Code Duplication    Length = 13-13 lines in 2 locations

source/Spiral/ORM/RecordEntity.php 1 location

@@ 582-594 (lines=13) @@
579
     */
580
    public function hasUpdates($field = null)
581
    {
582
        if (empty($field)) {
583
            if (!empty($this->updates)) {
584
                return true;
585
            }
586
587
            foreach ($this->fields as $field => $value) {
588
                if ($value instanceof RecordAccessorInterface && $value->hasUpdates()) {
589
                    return true;
590
                }
591
            }
592
593
            return false;
594
        }
595
596
        if (array_key_exists($field, $this->updates)) {
597
            return true;

source/Spiral/ODM/DocumentEntity.php 1 location

@@ 446-458 (lines=13) @@
443
     */
444
    public function hasUpdates($field = null, $atomicsOnly = false)
445
    {
446
        if (empty($field)) {
447
            if (!empty($this->updates) || !empty($this->atomics)) {
448
                return true;
449
            }
450
451
            foreach ($this->fields as $field => $value) {
452
                if ($value instanceof DocumentAccessorInterface && $value->hasUpdates()) {
453
                    return true;
454
                }
455
            }
456
457
            return false;
458
        }
459
460
        foreach ($this->atomics as $operations) {
461
            if (array_key_exists($field, $operations)) {