Code Duplication    Length = 27-29 lines in 2 locations

src/Discovery/DiscoveryManagerImpl.php 1 location

@@ 541-567 (lines=27) @@
538
    /**
539
     * {@inheritdoc}
540
     */
541
    public function removeRootBindingDescriptors(Expression $expr)
542
    {
543
        $this->assertModulesLoaded();
544
545
        $tx = new Transaction();
546
547
        try {
548
            foreach ($this->getRootBindingDescriptors() as $bindingDescriptor) {
549
                if ($expr->evaluate($bindingDescriptor)) {
550
                    $syncOp = $this->syncBindingUuid($bindingDescriptor->getUuid());
551
                    $syncOp->takeSnapshot();
552
553
                    $tx->execute($this->unloadBindingDescriptor($bindingDescriptor));
554
                    $tx->execute($syncOp);
555
                    $tx->execute($this->removeBindingDescriptorFromModuleFile($bindingDescriptor->getUuid()));
556
                }
557
            }
558
559
            $this->saveRootModuleFile();
560
561
            $tx->commit();
562
        } catch (Exception $e) {
563
            $tx->rollback();
564
565
            throw $e;
566
        }
567
    }
568
569
    /**
570
     * {@inheritdoc}

src/Repository/RepositoryManagerImpl.php 1 location

@@ 243-271 (lines=29) @@
240
    /**
241
     * {@inheritdoc}
242
     */
243
    public function removeRootPathMappings(Expression $expr)
244
    {
245
        $this->assertMappingsLoaded();
246
247
        $tx = new Transaction();
248
249
        try {
250
            foreach ($this->getRootPathMappings() as $mapping) {
251
                if ($expr->evaluate($mapping)) {
252
                    $syncOp = $this->syncRepositoryPath($mapping->getRepositoryPath());
253
                    $syncOp->takeSnapshot();
254
255
                    $tx->execute($this->unloadPathMapping($mapping));
256
                    $tx->execute($this->removePathMappingFromModuleFile($mapping->getRepositoryPath()));
257
                    $tx->execute($syncOp);
258
                }
259
            }
260
261
            $this->saveRootModuleFile();
262
263
            $tx->commit();
264
        } catch (Exception $e) {
265
            $tx->rollback();
266
267
            throw $e;
268
        }
269
270
        $this->removeResolvedConflicts();
271
    }
272
273
    /**
274
     * {@inheritdoc}