Code Duplication    Length = 15-15 lines in 3 locations

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

@@ 1597-1611 (lines=15) @@
1594
     * @param  ChildConnection $connection The ChildConnection object to remove.
1595
     * @return $this|ChildInstance The current object (for fluent API support)
1596
     */
1597
    public function removeConnection(ChildConnection $connection)
1598
    {
1599
        if ($this->getConnections()->contains($connection)) {
1600
            $pos = $this->collConnections->search($connection);
1601
            $this->collConnections->remove($pos);
1602
            if (null === $this->connectionsScheduledForDeletion) {
1603
                $this->connectionsScheduledForDeletion = clone $this->collConnections;
1604
                $this->connectionsScheduledForDeletion->clear();
1605
            }
1606
            $this->connectionsScheduledForDeletion[]= clone $connection;
1607
            $connection->setInstance(null);
1608
        }
1609
1610
        return $this;
1611
    }
1612
1613
1614
    /**

src/cli/Database/Base/User.php 2 locations

@@ 1482-1496 (lines=15) @@
1479
     * @param  ChildConnection $connection The ChildConnection object to remove.
1480
     * @return $this|ChildUser The current object (for fluent API support)
1481
     */
1482
    public function removeConnection(ChildConnection $connection)
1483
    {
1484
        if ($this->getConnections()->contains($connection)) {
1485
            $pos = $this->collConnections->search($connection);
1486
            $this->collConnections->remove($pos);
1487
            if (null === $this->connectionsScheduledForDeletion) {
1488
                $this->connectionsScheduledForDeletion = clone $this->collConnections;
1489
                $this->connectionsScheduledForDeletion->clear();
1490
            }
1491
            $this->connectionsScheduledForDeletion[]= $connection;
1492
            $connection->setUser(null);
1493
        }
1494
1495
        return $this;
1496
    }
1497
1498
1499
    /**
@@ 1732-1746 (lines=15) @@
1729
     * @param  ChildSubscription $subscription The ChildSubscription object to remove.
1730
     * @return $this|ChildUser The current object (for fluent API support)
1731
     */
1732
    public function removeSubscription(ChildSubscription $subscription)
1733
    {
1734
        if ($this->getSubscriptions()->contains($subscription)) {
1735
            $pos = $this->collSubscriptions->search($subscription);
1736
            $this->collSubscriptions->remove($pos);
1737
            if (null === $this->subscriptionsScheduledForDeletion) {
1738
                $this->subscriptionsScheduledForDeletion = clone $this->collSubscriptions;
1739
                $this->subscriptionsScheduledForDeletion->clear();
1740
            }
1741
            $this->subscriptionsScheduledForDeletion[]= $subscription;
1742
            $subscription->setUser(null);
1743
        }
1744
1745
        return $this;
1746
    }
1747
1748
1749
    /**