]> source.dussan.org Git - nextcloud-server.git/commitdiff
Code cleanup
authorRoeland Jago Douma <roeland@famdouma.nl>
Tue, 22 Nov 2016 10:42:46 +0000 (11:42 +0100)
committerRoeland Jago Douma <roeland@famdouma.nl>
Fri, 6 Jan 2017 08:42:13 +0000 (09:42 +0100)
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
core/Controller/CssController.php
lib/private/CssManager.php
lib/private/Server.php
lib/private/Template/SCSSCacher.php
lib/public/ICssManager.php

index 323dd21496b3409f1b25ef066f75d4aa0fdfd132..a8d182418d4b1af2655f975c83b5bb46afdbc1a0 100644 (file)
@@ -59,7 +59,7 @@ class CssController extends Controller {
         *
         * @param string $fileName css filename with extension
         * @param string $appName css folder name
-        * @return text/css
+        * @return FileDisplayResponse|NotFoundResponse
         */
        public function getCss($fileName, $appName) {
                try {
index 8ab9a778b1c84ee82a3ad52051b2f231ea580a50..ba5ce0dd2bfff8dfdc28ec077e82eb87655f9dea 100644 (file)
@@ -23,6 +23,7 @@ namespace OC;
 
 use OCP\Files\IAppData;
 use OCP\Files\NotFoundException;
+use OCP\Files\SimpleFS\ISimpleFile;
 use OCP\ICssManager;
 
 /**
@@ -53,15 +54,7 @@ class CssManager implements ICssManager {
         * @throws NotFoundException
         */
        public function getCss($fileName, $appName) {
-               try {
-                       $folder = $this->appData->getFolder($appName);
-               } catch(NotFoundException $e) {
-                       throw new NotFoundException();
-               }
-               try {
-                       return $folder->getFile($fileName);
-               } catch(NotFoundException $e) {
-                       throw new NotFoundException();
-               }
+               $folder = $this->appData->getFolder($appName);
+               return $folder->getFile($fileName);
        }
 }
index 381ac3fa9839a4be5ffaf59be028edc411b86314..b3449f14c357e229b74ea7a83f69be1592cd0dca 100644 (file)
@@ -417,7 +417,7 @@ class Server extends ServerContainer implements IServerContainer {
                                $c->getConfig()
                        );
                });
-               $this->registerService('CssManager', function (Server $c) {
+               $this->registerService(CssManager::class, function (Server $c) {
                        return new CssManager(
                                $c->getAppDataDir('css')
                        );
@@ -918,7 +918,7 @@ class Server extends ServerContainer implements IServerContainer {
         * @return \OCP\ICssManager
         */
        public function getCssManager() {
-               return $this->query('CssManager');
+               return $this->query(CssManager::class);
        }
 
        /**
index 0b22e44d7c6feed64db599c7bf11bd0e89e449bf..db08653c884aa520615e8b0a0b065c1e04d2af5a 100755 (executable)
@@ -23,8 +23,8 @@ namespace OC\Template;
 
 use Leafo\ScssPhp\Compiler;
 use Leafo\ScssPhp\Exception\ParserException;
+use OC\Files\SimpleFS\SimpleFolder;
 use OCP\Files\NotFoundException;
-use OCP\IURLGenerator;
 
 class SCSSCacher {
 
@@ -35,7 +35,7 @@ class SCSSCacher {
         * @var string The css filename with extension
         * @var string Absolute path to scss file location folder
         * @var string Path to scss file from the root installation
-        * @var OC\Files\SimpleFS\SimpleFolder The folder we're putting our compiled css files
+        * @var SimpleFolder The folder we're putting our compiled css files
         */
        protected $root, $file, $fileNameSCSS, $fileNameCSS, $fileLoc, $rootCssLoc, $folder;
 
@@ -150,7 +150,6 @@ class SCSSCacher {
                } catch(NotFoundException $e) {
                        return false;
                }
-               return false;
        }
 
        /**
index 776ffefd82367f5967760e5fa5c2a876806d35f3..388015029745cde0e61afbc8cfff7cc18bc6b590 100644 (file)
@@ -21,6 +21,9 @@
 
 namespace OCP;
 
+use OCP\Files\NotFoundException;
+use OCP\Files\SimpleFS\ISimpleFile;
+
 /**
  * This class provides scss functionality
  * @since 11.0.0
@@ -34,6 +37,7 @@ interface ICssManager {
         * @param string $fileName css filename with extension
         * @param string $appName css app name
         * @return ISimpleFile
+        * @throws NotFoundException
         */
        public function getCss($fileName, $appName);
 }