/** * {@inheritdoc} */ public function execute() { if (!$this->repositoryPaths) { // Check all paths if none are passed $this->repositoryPaths = $this->conflicts->getRepositoryPaths(); } // Mark all as resolved foreach ($this->repositoryPaths as $repositoryPath) { if ($this->conflicts->has($repositoryPath)) { $conflict = $this->conflicts->get($repositoryPath); $this->conflicts->remove($repositoryPath); $this->removedConflicts[$repositoryPath] = $conflict->getMappings(); $conflict->resolve(); } } $packageConflicts = $this->conflictDetector->detectConflicts($this->repositoryPaths); $this->deduplicatePackageConflicts($packageConflicts); foreach ($packageConflicts as $packageConflict) { $repositoryPath = $packageConflict->getConflictingToken(); $conflict = new PathConflict($repositoryPath); foreach ($packageConflict->getPackageNames() as $packageName) { $conflict->addMapping($this->mappingsByResource->get($repositoryPath, $packageName)); } $this->conflicts->add($conflict); $this->addedConflicts[] = $repositoryPath; } }
/** * {@inheritdoc} */ public function getPathMapping($repositoryPath, $packageName) { Assert::string($repositoryPath, 'The repository path must be a string. Got: %s'); Assert::string($packageName, 'The package name must be a string. Got: %s'); $this->assertMappingsLoaded(); if (!$this->mappings->contains($repositoryPath, $packageName)) { throw NoSuchPathMappingException::forRepositoryPathAndPackage($repositoryPath, $packageName); } return $this->mappings->get($repositoryPath, $packageName); }