private function blend($toBlend, OutputInterface $output)
    {
        $fs         = new Filesystem();
        $vendorDir  = $this->getContainer()->getParameter('kernel.root_dir') . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'vendor';

        foreach ($toBlend as $vendor => $names) {
            foreach ($names as $name => $path) {
                $originPath = realpath($vendorDir . DIRECTORY_SEPARATOR . $vendor . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR));
                $targetDir  = realpath($this->bundlePath) . DIRECTORY_SEPARATOR . $vendor;
                $targetPath = $targetDir . DIRECTORY_SEPARATOR . $name;

                if (!$originPath) {
                    throw new \InvalidArgumentException(sprintf('The origin path for "%s" does not exist : "%s"', "$vendor/$name", $originPath));
                }

                if (!$fs->exists($targetDir)) {
                    $fs->mkdir($targetDir);
                }

                // Switch for symlink to hard copy or from hard copy to symlink
                if (is_link($targetPath) && (!isset($this->config['symlink']) || !$this->config['symlink'])
                    ||
                    is_dir($targetPath) && isset($this->config['symlink']) && $this->config['symlink']
                ) {
                    $fs->remove($targetPath);
                }

                if (isset($this->config['symlink']) && $this->config['symlink']) {
                    $fs->symlink($originPath, $targetPath);
                } else {
                    $fs->mirror($originPath, $targetPath, null, array('delete' => true, 'override' => true));
                }

                $output->writeln(sprintf('The library <info>%s/%s</info> has been added', $vendor, $name));
            }
        }
    }
private function blend($toBlend, OutputInterface $output)
    {
        $fs         = new Filesystem();
        $vendorDir  = $this->getContainer()->getParameter('kernel.root_dir') . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'vendor';

        foreach ($toBlend as $vendor => $names) {
            foreach ($names as $name => $path) {
                $originPath = realpath($vendorDir . DIRECTORY_SEPARATOR . $vendor . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR));
                $targetDir  = realpath($this->bundlePath) . DIRECTORY_SEPARATOR . $vendor;
                $targetPath = $targetDir . DIRECTORY_SEPARATOR . $name;

                if (!$originPath) {
                    throw new \InvalidArgumentException(sprintf('The origin path for "%s" does not exist : "%s"', "$vendor/$name", $originPath));
                }

                if (!$fs->exists($targetDir)) {
                    $fs->mkdir($targetDir);
                }

                // Switch for symlink to hard copy or from hard copy to symlink
                if (is_link($targetPath) && (!isset($this->config['symlink']) || !$this->config['symlink'])
                    ||
                    is_dir($targetPath) && isset($this->config['symlink']) && $this->config['symlink']
                ) {
                    $fs->remove($targetPath);
                }

                if (isset($this->config['symlink']) && $this->config['symlink']) {
                    $fs->symlink($originPath, $targetPath);
                } else {
                    $fs->mirror($originPath, $targetPath, null, array('delete' => true, 'override' => true));
                }

                $output->writeln(sprintf('The library <info>%s/%s</info> has been added', $vendor, $name));
            }
        }
    }
private function blend ( $ toBlend , OutputInterface $ output ) { $ fs = new Filesystem ( ) ; $ vendorDir = $ this -> getContainer ( ) -> getParameter ( 'kernel.root_dir' ) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'vendor' ; foreach ( $ toBlend as $ vendor => $ names ) { foreach ( $ names as $ name => $ path ) { $ originPath = realpath ( $ vendorDir . DIRECTORY_SEPARATOR . $ vendor . DIRECTORY_SEPARATOR . $ name . DIRECTORY_SEPARATOR . ltrim ( $ path , DIRECTORY_SEPARATOR ) ) ; $ targetDir = realpath ( $ this -> bundlePath ) . DIRECTORY_SEPARATOR . $ vendor ; $ targetPath = $ targetDir . DIRECTORY_SEPARATOR . $ name ; if ( ! $ originPath ) { throw new \ InvalidArgumentException ( sprintf ( 'The origin path for "%s" does not exist : "%s"' , "$vendor/$name" , $ originPath ) ) ; } if ( ! $ fs -> exists ( $ targetDir ) ) { $ fs -> mkdir ( $ targetDir ) ; } // Switch for symlink to hard copy or from hard copy to symlink if ( is_link ( $ targetPath ) && ( ! isset ( $ this -> config [ 'symlink' ] ) || ! $ this -> config [ 'symlink' ] ) || is_dir ( $ targetPath ) && isset ( $ this -> config [ 'symlink' ] ) && $ this -> config [ 'symlink' ] ) { $ fs -> remove ( $ targetPath ) ; } if ( isset ( $ this -> config [ 'symlink' ] ) && $ this -> config [ 'symlink' ] ) { $ fs -> symlink ( $ originPath , $ targetPath ) ; } else { $ fs -> mirror ( $ originPath , $ targetPath , null , array ( 'delete' => true , 'override' => true ) ) ; } $ output -> writeln ( sprintf ( 'The library <info>%s/%s</info> has been added' , $ vendor , $ name ) ) ; } } }
Blend bundles into prestaComposer vendor directory

@param $toBlend
@param OutputInterface $output
@throws \InvalidArgumentException
Blend bundles into prestaComposer vendor directory