protected function mergeFiles(array $patterns, $required = false)
    {
        $root = $this->composer->getPackage();

        $files = array_map(
            function ($files, $pattern) use ($required) {
                if ($required && !$files) {
                    throw new MissingFileException(
                        "merge-plugin: No files matched required '{$pattern}'"
                    );
                }
                return $files;
            },
            array_map('glob', $patterns),
            $patterns
        );

        foreach (array_reduce($files, 'array_merge', array()) as $path) {
            $this->mergeFile($root, $path);
        }
    }
protected function mergeFiles(array $patterns, $required = false)
    {
        $root = $this->composer->getPackage();

        $files = array_map(
            function ($files, $pattern) use ($required) {
                if ($required && !$files) {
                    throw new MissingFileException(
                        "merge-plugin: No files matched required '{$pattern}'"
                    );
                }
                return $files;
            },
            array_map('glob', $patterns),
            $patterns
        );

        foreach (array_reduce($files, 'array_merge', array()) as $path) {
            $this->mergeFile($root, $path);
        }
    }
protected function mergeFiles ( array $ patterns , $ required = false ) { $ root = $ this -> composer -> getPackage ( ) ; $ files = array_map ( function ( $ files , $ pattern ) use ( $ required ) { if ( $ required && ! $ files ) { throw new MissingFileException ( "merge-plugin: No files matched required '{$pattern}'" ) ; } return $ files ; } , array_map ( 'glob' , $ patterns ) , $ patterns ) ; foreach ( array_reduce ( $ files , 'array_merge' , array ( ) ) as $ path ) { $ this -> mergeFile ( $ root , $ path ) ; } }
Find configuration files matching the configured glob patterns and
merge their contents with the master package.

@param array $patterns List of files/glob patterns
@param bool $required Are the patterns required to match files?
@throws MissingFileException when required and a pattern returns no
results
Find configuration files matching the configured glob patterns and merge their contents with the master package .