protected function removeSymlinks(
        PackageInterface $package,
        $targetRoot,
        array $pathMap,
        $mode = self::INVALID_FAIL
    ) {
        if (empty($pathMap)) {
            return;
        }

        $packageRoot = $this->getInstallPath($package);
        $actions     = [];

        // Check the file map first and make sure we only remove our own symlinks.
        foreach ($pathMap as $sourcePath => $targetPath) {
            $source = $this->filesystem->normalizePath($packageRoot . ($sourcePath ? ('/'.$sourcePath) : ''));
            $target = $this->filesystem->normalizePath($targetRoot . '/' . $targetPath);

            if ($this->canRemoveSymlink($source, $target, $mode)) {
                $actions[] = $target;
            }
        }

        // Remove the symlinks if everything is ok.
        foreach ($actions as $target) {
            $this->logRemove($target);

            if (is_dir($target)) {
                $this->filesystem->removeDirectory($target);
            } else {
                $this->filesystem->unlink($target);
            }

            $this->removeEmptyDirectories(dirname($target), $targetRoot);
        }
    }
protected function removeSymlinks(
        PackageInterface $package,
        $targetRoot,
        array $pathMap,
        $mode = self::INVALID_FAIL
    ) {
        if (empty($pathMap)) {
            return;
        }

        $packageRoot = $this->getInstallPath($package);
        $actions     = [];

        // Check the file map first and make sure we only remove our own symlinks.
        foreach ($pathMap as $sourcePath => $targetPath) {
            $source = $this->filesystem->normalizePath($packageRoot . ($sourcePath ? ('/'.$sourcePath) : ''));
            $target = $this->filesystem->normalizePath($targetRoot . '/' . $targetPath);

            if ($this->canRemoveSymlink($source, $target, $mode)) {
                $actions[] = $target;
            }
        }

        // Remove the symlinks if everything is ok.
        foreach ($actions as $target) {
            $this->logRemove($target);

            if (is_dir($target)) {
                $this->filesystem->removeDirectory($target);
            } else {
                $this->filesystem->unlink($target);
            }

            $this->removeEmptyDirectories(dirname($target), $targetRoot);
        }
    }
protected function removeSymlinks ( PackageInterface $ package , $ targetRoot , array $ pathMap , $ mode = self :: INVALID_FAIL ) { if ( empty ( $ pathMap ) ) { return ; } $ packageRoot = $ this -> getInstallPath ( $ package ) ; $ actions = [ ] ; // Check the file map first and make sure we only remove our own symlinks. foreach ( $ pathMap as $ sourcePath => $ targetPath ) { $ source = $ this -> filesystem -> normalizePath ( $ packageRoot . ( $ sourcePath ? ( '/' . $ sourcePath ) : '' ) ) ; $ target = $ this -> filesystem -> normalizePath ( $ targetRoot . '/' . $ targetPath ) ; if ( $ this -> canRemoveSymlink ( $ source , $ target , $ mode ) ) { $ actions [ ] = $ target ; } } // Remove the symlinks if everything is ok. foreach ( $ actions as $ target ) { $ this -> logRemove ( $ target ) ; if ( is_dir ( $ target ) ) { $ this -> filesystem -> removeDirectory ( $ target ) ; } else { $ this -> filesystem -> unlink ( $ target ) ; } $ this -> removeEmptyDirectories ( dirname ( $ target ) , $ targetRoot ) ; } }
Removes symlinks from a map of relative file paths.
Key is the relative path to composer package, whereas "value" is relative to Contao root.

@param PackageInterface $package    The package being processed.
@param string           $targetRoot The target directory.
@param array            $pathMap    The path mapping.
@param int              $mode       The mode how to handle duplicate files.

@return void
Removes symlinks from a map of relative file paths . Key is the relative path to composer package whereas value is relative to Contao root .