Code Duplication    Length = 10-10 lines in 5 locations

src/cli/Database/Base/Channel.php 1 location

@@ 664-673 (lines=10) @@
661
                $this->setInstance($this->aInstance);
662
            }
663
664
            if ($this->isNew() || $this->isModified()) {
665
                // persist changes
666
                if ($this->isNew()) {
667
                    $this->doInsert($con);
668
                    $affectedRows += 1;
669
                } else {
670
                    $affectedRows += $this->doUpdate($con);
671
                }
672
                $this->resetModified();
673
            }
674
675
            if ($this->subscriptionsScheduledForDeletion !== null) {
676
                if (!$this->subscriptionsScheduledForDeletion->isEmpty()) {

src/cli/Database/Base/Connection.php 1 location

@@ 799-808 (lines=10) @@
796
                $this->setUser($this->aUser);
797
            }
798
799
            if ($this->isNew() || $this->isModified()) {
800
                // persist changes
801
                if ($this->isNew()) {
802
                    $this->doInsert($con);
803
                    $affectedRows += 1;
804
                } else {
805
                    $affectedRows += $this->doUpdate($con);
806
                }
807
                $this->resetModified();
808
            }
809
810
            $this->alreadyInSave = false;
811

src/cli/Database/Base/Instance.php 1 location

@@ 608-617 (lines=10) @@
605
        if (!$this->alreadyInSave) {
606
            $this->alreadyInSave = true;
607
608
            if ($this->isNew() || $this->isModified()) {
609
                // persist changes
610
                if ($this->isNew()) {
611
                    $this->doInsert($con);
612
                    $affectedRows += 1;
613
                } else {
614
                    $affectedRows += $this->doUpdate($con);
615
                }
616
                $this->resetModified();
617
            }
618
619
            if ($this->usersScheduledForDeletion !== null) {
620
                if (!$this->usersScheduledForDeletion->isEmpty()) {

src/cli/Database/Base/Subscription.php 1 location

@@ 951-960 (lines=10) @@
948
                $this->setChannel($this->aChannel);
949
            }
950
951
            if ($this->isNew() || $this->isModified()) {
952
                // persist changes
953
                if ($this->isNew()) {
954
                    $this->doInsert($con);
955
                    $affectedRows += 1;
956
                } else {
957
                    $affectedRows += $this->doUpdate($con);
958
                }
959
                $this->resetModified();
960
            }
961
962
            $this->alreadyInSave = false;
963

src/cli/Database/Base/User.php 1 location

@@ 681-690 (lines=10) @@
678
                $this->setInstance($this->aInstance);
679
            }
680
681
            if ($this->isNew() || $this->isModified()) {
682
                // persist changes
683
                if ($this->isNew()) {
684
                    $this->doInsert($con);
685
                    $affectedRows += 1;
686
                } else {
687
                    $affectedRows += $this->doUpdate($con);
688
                }
689
                $this->resetModified();
690
            }
691
692
            if ($this->connectionsScheduledForDeletion !== null) {
693
                if (!$this->connectionsScheduledForDeletion->isEmpty()) {