public function getSubDirs($depth = 0)
	{
		$dirs = [];

		$contents = $this->hasAdapterOrFail()->adapter->listContents($this->getPath(), false);
		foreach ($contents as $item)
		{
			if ($item->isDir())
			{
				$thisDir = new stdClass();
				$thisDir->depth = $depth;
				$thisDir->subdirs = $item->getSubDirs($depth+1);
				$thisDir->name = $item->getDisplayName();
				$thisDir->path = $item->getPath();
				$dirs[] = $thisDir;
			}
		}
		return $dirs;
	}
public function getSubDirs($depth = 0)
	{
		$dirs = [];

		$contents = $this->hasAdapterOrFail()->adapter->listContents($this->getPath(), false);
		foreach ($contents as $item)
		{
			if ($item->isDir())
			{
				$thisDir = new stdClass();
				$thisDir->depth = $depth;
				$thisDir->subdirs = $item->getSubDirs($depth+1);
				$thisDir->name = $item->getDisplayName();
				$thisDir->path = $item->getPath();
				$dirs[] = $thisDir;
			}
		}
		return $dirs;
	}
public function getSubDirs ( $ depth = 0 ) { $ dirs = [ ] ; $ contents = $ this -> hasAdapterOrFail ( ) -> adapter -> listContents ( $ this -> getPath ( ) , false ) ; foreach ( $ contents as $ item ) { if ( $ item -> isDir ( ) ) { $ thisDir = new stdClass ( ) ; $ thisDir -> depth = $ depth ; $ thisDir -> subdirs = $ item -> getSubDirs ( $ depth + 1 ) ; $ thisDir -> name = $ item -> getDisplayName ( ) ; $ thisDir -> path = $ item -> getPath ( ) ; $ dirs [ ] = $ thisDir ; } } return $ dirs ; }
Gets a list of directory objects with a depth for walking a directory structure

@param		int	$depth	How deep you currently are since beginning to walk
@return	array
Gets a list of directory objects with a depth for walking a directory structure