Puli\Manager\Api\Repository\PathMapping::removeConflict PHP Method

removeConflict() public method

The method {@link load()} needs to be called before calling this method, otherwise an exception is thrown.
public removeConflict ( Puli\Manager\Api\Repository\PathConflict $conflict )
$conflict Puli\Manager\Api\Repository\PathConflict The conflict to remove.
    public function removeConflict(PathConflict $conflict)
    {
        if (null === $this->state) {
            throw new NotLoadedException('The mapping is not loaded.');
        }
        $repositoryPath = $conflict->getRepositoryPath();
        if (!isset($this->conflicts[$repositoryPath]) || $conflict !== $this->conflicts[$repositoryPath]) {
            return;
        }
        unset($this->conflicts[$repositoryPath]);
        $conflict->removeMapping($this);
        $this->refreshState();
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Removes a path mapping from the conflict.
  *
  * If only one path mapping is left after removing this mapping, that
  * mapping is removed as well. The conflict is then resolved.
  *
  * @param PathMapping $mapping The path mapping to remove.
  *
  * @throws NotLoadedException If the passed mapping is not loaded.
  */
 public function removeMapping(PathMapping $mapping)
 {
     if (!$mapping->isLoaded()) {
         throw new NotLoadedException('The passed mapping must be loaded.');
     }
     $packageName = $mapping->getContainingPackage()->getName();
     if (!isset($this->mappings[$packageName]) || $mapping !== $this->mappings[$packageName]) {
         return;
     }
     unset($this->mappings[$packageName]);
     $mapping->removeConflict($this);
     // Conflict was resolved
     if (count($this->mappings) < 2) {
         $resolvedMappings = $this->mappings;
         $this->mappings = array();
         foreach ($resolvedMappings as $resolvedMapping) {
             $resolvedMapping->removeConflict($this);
         }
     }
 }
All Usage Examples Of Puli\Manager\Api\Repository\PathMapping::removeConflict