protected static function _filter($libs, array $config, array $options = []) {
		if (is_callable($options['format'])) {
			foreach ($libs as $i => $file) {
				$libs[$i] = $options['format']($file, $config);
			}
			$libs = $options['name'] ? preg_grep("/{$options['name']}$/", $libs) : $libs;
		}
		if ($exclude = $options['exclude']) {
			if (is_string($exclude)) {
				$libs = preg_grep($exclude, $libs, PREG_GREP_INVERT);
			} elseif (is_callable($exclude)) {
				$libs = array_values(array_filter($libs, $exclude));
			}
		}
		if ($filter = $options['filter']) {
			if (is_string($filter)) {
				$libs = preg_grep($filter, $libs) ;
			} elseif (is_callable($filter)) {
				$libs = array_filter(array_map($filter, $libs));
			}
		}
		return $libs;
	}
protected static function _filter($libs, array $config, array $options = []) {
		if (is_callable($options['format'])) {
			foreach ($libs as $i => $file) {
				$libs[$i] = $options['format']($file, $config);
			}
			$libs = $options['name'] ? preg_grep("/{$options['name']}$/", $libs) : $libs;
		}
		if ($exclude = $options['exclude']) {
			if (is_string($exclude)) {
				$libs = preg_grep($exclude, $libs, PREG_GREP_INVERT);
			} elseif (is_callable($exclude)) {
				$libs = array_values(array_filter($libs, $exclude));
			}
		}
		if ($filter = $options['filter']) {
			if (is_string($filter)) {
				$libs = preg_grep($filter, $libs) ;
			} elseif (is_callable($filter)) {
				$libs = array_filter(array_map($filter, $libs));
			}
		}
		return $libs;
	}
protected static function _filter ( $ libs , array $ config , array $ options = [ ] ) { if ( is_callable ( $ options [ 'format' ] ) ) { foreach ( $ libs as $ i => $ file ) { $ libs [ $ i ] = $ options [ 'format' ] ( $ file , $ config ) ; } $ libs = $ options [ 'name' ] ? preg_grep ( "/{$options['name']}$/" , $ libs ) : $ libs ; } if ( $ exclude = $ options [ 'exclude' ] ) { if ( is_string ( $ exclude ) ) { $ libs = preg_grep ( $ exclude , $ libs , PREG_GREP_INVERT ) ; } elseif ( is_callable ( $ exclude ) ) { $ libs = array_values ( array_filter ( $ libs , $ exclude ) ) ; } } if ( $ filter = $ options [ 'filter' ] ) { if ( is_string ( $ filter ) ) { $ libs = preg_grep ( $ filter , $ libs ) ; } elseif ( is_callable ( $ filter ) ) { $ libs = array_filter ( array_map ( $ filter , $ libs ) ) ; } } return $ libs ; }
Filters a list of library search results by the given set of options.

@param array $libs List of found libraries.
@param array $config The configuration of the library currently being searched within.
@param array $options The options used to filter/format `$libs`.
@return array Returns a copy of `$libs`, filtered and transformed based on the configuration
provided in `$options`.
Filters a list of library search results by the given set of options .