framework/RedKiteCms/Tools/FilesystemTools.php
public static function cascade(array $folders)
    {
        $result = null;
        foreach ($folders as $folder) {
            if (is_dir($folder)) {
                $result = $folder;

                break;
            }
        }

        return $result;
    }
public static function cascade(array $folders)
    {
        $result = null;
        foreach ($folders as $folder) {
            if (is_dir($folder)) {
                $result = $folder;

                break;
            }
        }

        return $result;
    }
Parses given folders and returns the first existing one

@param array $folder

@return null|string