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

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

        // Check the file map first and make sure nothing exists.
        foreach ($pathMap as $sourcePath => $targetPath) {
            $source = $this->filesystem->normalizePath($packageRoot . (empty($sourcePath) ? '' : ('/'.$sourcePath)));
            $target = $this->filesystem->normalizePath($targetRoot . '/' . $targetPath);

            if (!is_readable($source)) {
                throw new \RuntimeException(
                    sprintf('Installation source "%s" does not exist', $sourcePath)
                );
            }

            if (file_exists($target) && !$this->canAddTarget($target, $mode)) {
                continue;
            }

            $actions[$source] = $target;
        }

        // Only actually create the links if the checks are successful to prevent orphans.
        foreach ($actions as $source => $target) {
            $this->logCopy($source, $target);
            $this->copyRecursive($source, $target);
        }
    }
protected function addCopies(PackageInterface $package, $targetRoot, array $pathMap, $mode = self::DUPLICATE_FAIL)
    {
        if (empty($pathMap)) {
            return;
        }

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

        // Check the file map first and make sure nothing exists.
        foreach ($pathMap as $sourcePath => $targetPath) {
            $source = $this->filesystem->normalizePath($packageRoot . (empty($sourcePath) ? '' : ('/'.$sourcePath)));
            $target = $this->filesystem->normalizePath($targetRoot . '/' . $targetPath);

            if (!is_readable($source)) {
                throw new \RuntimeException(
                    sprintf('Installation source "%s" does not exist', $sourcePath)
                );
            }

            if (file_exists($target) && !$this->canAddTarget($target, $mode)) {
                continue;
            }

            $actions[$source] = $target;
        }

        // Only actually create the links if the checks are successful to prevent orphans.
        foreach ($actions as $source => $target) {
            $this->logCopy($source, $target);
            $this->copyRecursive($source, $target);
        }
    }
protected function addCopies ( PackageInterface $ package , $ targetRoot , array $ pathMap , $ mode = self :: DUPLICATE_FAIL ) { if ( empty ( $ pathMap ) ) { return ; } $ packageRoot = $ this -> getInstallPath ( $ package ) ; $ actions = [ ] ; // Check the file map first and make sure nothing exists. foreach ( $ pathMap as $ sourcePath => $ targetPath ) { $ source = $ this -> filesystem -> normalizePath ( $ packageRoot . ( empty ( $ sourcePath ) ? '' : ( '/' . $ sourcePath ) ) ) ; $ target = $ this -> filesystem -> normalizePath ( $ targetRoot . '/' . $ targetPath ) ; if ( ! is_readable ( $ source ) ) { throw new \ RuntimeException ( sprintf ( 'Installation source "%s" does not exist' , $ sourcePath ) ) ; } if ( file_exists ( $ target ) && ! $ this -> canAddTarget ( $ target , $ mode ) ) { continue ; } $ actions [ $ source ] = $ target ; } // Only actually create the links if the checks are successful to prevent orphans. foreach ( $ actions as $ source => $ target ) { $ this -> logCopy ( $ source , $ target ) ; $ this -> copyRecursive ( $ source , $ target ) ; } }
Creates copies for 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

@throws \RuntimeException When a source path does not exist or is not readable.
Creates copies for a map of relative file paths . Key is the relative path to composer package whereas value is relative to Contao root .