Code Duplication    Length = 27-29 lines in 2 locations

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}

src/Discovery/DiscoveryManagerImpl.php 1 location

@@ 504-530 (lines=27) @@
501
    /**
502
     * {@inheritdoc}
503
     */
504
    public function removeRootBindingDescriptors(Expression $expr)
505
    {
506
        $this->assertModulesLoaded();
507
508
        $tx = new Transaction();
509
510
        try {
511
            foreach ($this->getRootBindingDescriptors() as $bindingDescriptor) {
512
                if ($expr->evaluate($bindingDescriptor)) {
513
                    $syncOp = $this->syncBinding($bindingDescriptor->getUuid());
514
                    $syncOp->takeSnapshot();
515
516
                    $tx->execute($this->unloadBindingDescriptor($bindingDescriptor));
517
                    $tx->execute($syncOp);
518
                    $tx->execute($this->removeBindingDescriptorFromModuleFile($bindingDescriptor->getUuid()));
519
                }
520
            }
521
522
            $this->saveRootModuleFile();
523
524
            $tx->commit();
525
        } catch (Exception $e) {
526
            $tx->rollback();
527
528
            throw $e;
529
        }
530
    }
531
532
    /**
533
     * {@inheritdoc}