public function contract(
        FileNodeCollectionInterface $files,
        FileNodeInterface $target,
        array $options = []
    ) {
        $this->options = $options;
        if (!$this->canContract($files, $target)) {
            throw new \InvalidArgumentException("The supplied files are not valid");
        }

        $this->log(LogLevel::INFO, "Merging files in collection $files into: {$target}");

        $filePaths = $files->map(function (LocalFile $item) {
            return $item->getPath();
        });

        $cmd = sprintf(
            'cat %s > %s',
            implode(' ', $filePaths),
            $target->getPath()
        );

        return $this->runCommand($files, $target, $cmd, $this->getOption('keepOldFiles', true));
    }
public function contract(
        FileNodeCollectionInterface $files,
        FileNodeInterface $target,
        array $options = []
    ) {
        $this->options = $options;
        if (!$this->canContract($files, $target)) {
            throw new \InvalidArgumentException("The supplied files are not valid");
        }

        $this->log(LogLevel::INFO, "Merging files in collection $files into: {$target}");

        $filePaths = $files->map(function (LocalFile $item) {
            return $item->getPath();
        });

        $cmd = sprintf(
            'cat %s > %s',
            implode(' ', $filePaths),
            $target->getPath()
        );

        return $this->runCommand($files, $target, $cmd, $this->getOption('keepOldFiles', true));
    }
public function contract ( FileNodeCollectionInterface $ files , FileNodeInterface $ target , array $ options = [ ] ) { $ this -> options = $ options ; if ( ! $ this -> canContract ( $ files , $ target ) ) { throw new \ InvalidArgumentException ( "The supplied files are not valid" ) ; } $ this -> log ( LogLevel :: INFO , "Merging files in collection $files into: {$target}" ) ; $ filePaths = $ files -> map ( function ( LocalFile $ item ) { return $ item -> getPath ( ) ; } ) ; $ cmd = sprintf ( 'cat %s > %s' , implode ( ' ' , $ filePaths ) , $ target -> getPath ( ) ) ; return $ this -> runCommand ( $ files , $ target , $ cmd , $ this -> getOption ( 'keepOldFiles' , true ) ) ; }
Do the expansion and return a collection

@param FileNodeCollectionInterface $files
@param FileNodeInterface           $target
@param array                       $options :keepOldFiles <bool> (Default: true) Keep the old files after merging

@return FileNodeInterface
Do the expansion and return a collection