removeConflict() public méthode

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.
 /**
  * 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);
         }
     }
 }
Exemple #2
0
 /**
  * @expectedException \Puli\Manager\Api\NotLoadedException
  */
 public function testRemoveConflictFailsIfNotLoaded()
 {
     $mapping = new PathMapping('/path', 'resources');
     $conflict = new PathConflict('/path/conflict');
     $mapping->removeConflict($conflict);
 }