src/Folder.php
public static function folders($path, $filter = '.', $recurse = false, $full = false, $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX'),
		$excludeFilter = array('^\..*')
	)
	{
		// Check to make sure the path valid and clean
		$path = Path::clean($path);

		// Is the path a folder?
		if (!is_dir($path))
		{
			throw new \UnexpectedValueException(sprintf('%1$s: Path is not a folder. Path: %2$s', __METHOD__, $path));
		}

		// Compute the excludefilter string
		if (\count($excludeFilter))
		{
			$excludeFilterString = '/(' . implode('|', $excludeFilter) . ')/';
		}
		else
		{
			$excludeFilterString = '';
		}

		// Get the folders
		$arr = self::_items($path, $filter, $recurse, $full, $exclude, $excludeFilterString, false);

		// Sort the folders
		asort($arr);

		return array_values($arr);
	}
public static function folders($path, $filter = '.', $recurse = false, $full = false, $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX'),
		$excludeFilter = array('^\..*')
	)
	{
		// Check to make sure the path valid and clean
		$path = Path::clean($path);

		// Is the path a folder?
		if (!is_dir($path))
		{
			throw new \UnexpectedValueException(sprintf('%1$s: Path is not a folder. Path: %2$s', __METHOD__, $path));
		}

		// Compute the excludefilter string
		if (\count($excludeFilter))
		{
			$excludeFilterString = '/(' . implode('|', $excludeFilter) . ')/';
		}
		else
		{
			$excludeFilterString = '';
		}

		// Get the folders
		$arr = self::_items($path, $filter, $recurse, $full, $exclude, $excludeFilterString, false);

		// Sort the folders
		asort($arr);

		return array_values($arr);
	}
public static function folders ( $ path , $ filter = '.' , $ recurse = false , $ full = false , $ exclude = array ( '.svn' , 'CVS' , '.DS_Store' , '__MACOSX' ) , $ excludeFilter = array ( '^\..*' ) ) { // Check to make sure the path valid and clean $ path = Path :: clean ( $ path ) ; // Is the path a folder? if ( ! is_dir ( $ path ) ) { throw new \ UnexpectedValueException ( sprintf ( '%1$s: Path is not a folder. Path: %2$s' , __METHOD__ , $ path ) ) ; } // Compute the excludefilter string if ( \ count ( $ excludeFilter ) ) { $ excludeFilterString = '/(' . implode ( '|' , $ excludeFilter ) . ')/' ; } else { $ excludeFilterString = '' ; } // Get the folders $ arr = self :: _items ( $ path , $ filter , $ recurse , $ full , $ exclude , $ excludeFilterString , false ) ; // Sort the folders asort ( $ arr ) ; return array_values ( $ arr ) ; }
Utility function to read the folders in a folder.

@param   string   $path           The path of the folder to read.
@param   string   $filter         A filter for folder names.
@param   mixed    $recurse        True to recursively search into sub-folders, or an integer to specify the maximum depth.
@param   boolean  $full           True to return the full path to the folders.
@param   array    $exclude        Array with names of folders which should not be shown in the result.
@param   array    $excludeFilter  Array with regular expressions matching folders which should not be shown in the result.

@return  array  Folders in the given folder.

@since   1.0
@throws  \UnexpectedValueException
Utility function to read the folders in a folder .