diff options
Diffstat (limited to 'lib/Service/WorkspaceService.php')
-rw-r--r-- | lib/Service/WorkspaceService.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/Service/WorkspaceService.php b/lib/Service/WorkspaceService.php new file mode 100644 index 000000000..761370814 --- /dev/null +++ b/lib/Service/WorkspaceService.php @@ -0,0 +1,31 @@ +<?php + + +namespace OCA\Text\Service; + + +use OCP\Files\Folder; +use OCP\Files\NotFoundException; + +class WorkspaceService { + + private const SUPPORTED_FILENAMES = [ + 'README.md', + 'Readme.md', + 'readme.md' + ]; + + public function getFile(Folder $folder) { + $file = null; + foreach (self::SUPPORTED_FILENAMES as $filename) { + if ($folder->nodeExists($filename)) { + try { + $file = $folder->get($filename); + } catch (NotFoundException $e) { + } + continue; + } + } + return $file; + } +} |