Code cleanup

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2016-11-22 11:42:46 +01:00
parent 1f769e6e76
commit 2816177ecb
No known key found for this signature in database
GPG Key ID: F941078878347C0C
5 changed files with 12 additions and 16 deletions

View File

@ -59,7 +59,7 @@ class CssController extends Controller {
* *
* @param string $fileName css filename with extension * @param string $fileName css filename with extension
* @param string $appName css folder name * @param string $appName css folder name
* @return text/css * @return FileDisplayResponse|NotFoundResponse
*/ */
public function getCss($fileName, $appName) { public function getCss($fileName, $appName) {
try { try {

View File

@ -23,6 +23,7 @@ namespace OC;
use OCP\Files\IAppData; use OCP\Files\IAppData;
use OCP\Files\NotFoundException; use OCP\Files\NotFoundException;
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\ICssManager; use OCP\ICssManager;
/** /**
@ -53,15 +54,7 @@ class CssManager implements ICssManager {
* @throws NotFoundException * @throws NotFoundException
*/ */
public function getCss($fileName, $appName) { public function getCss($fileName, $appName) {
try {
$folder = $this->appData->getFolder($appName); $folder = $this->appData->getFolder($appName);
} catch(NotFoundException $e) {
throw new NotFoundException();
}
try {
return $folder->getFile($fileName); return $folder->getFile($fileName);
} catch(NotFoundException $e) {
throw new NotFoundException();
}
} }
} }

View File

@ -417,7 +417,7 @@ class Server extends ServerContainer implements IServerContainer {
$c->getConfig() $c->getConfig()
); );
}); });
$this->registerService('CssManager', function (Server $c) { $this->registerService(CssManager::class, function (Server $c) {
return new CssManager( return new CssManager(
$c->getAppDataDir('css') $c->getAppDataDir('css')
); );
@ -918,7 +918,7 @@ class Server extends ServerContainer implements IServerContainer {
* @return \OCP\ICssManager * @return \OCP\ICssManager
*/ */
public function getCssManager() { public function getCssManager() {
return $this->query('CssManager'); return $this->query(CssManager::class);
} }
/** /**

View File

@ -23,8 +23,8 @@ namespace OC\Template;
use Leafo\ScssPhp\Compiler; use Leafo\ScssPhp\Compiler;
use Leafo\ScssPhp\Exception\ParserException; use Leafo\ScssPhp\Exception\ParserException;
use OC\Files\SimpleFS\SimpleFolder;
use OCP\Files\NotFoundException; use OCP\Files\NotFoundException;
use OCP\IURLGenerator;
class SCSSCacher { class SCSSCacher {
@ -35,7 +35,7 @@ class SCSSCacher {
* @var string The css filename with extension * @var string The css filename with extension
* @var string Absolute path to scss file location folder * @var string Absolute path to scss file location folder
* @var string Path to scss file from the root installation * @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; protected $root, $file, $fileNameSCSS, $fileNameCSS, $fileLoc, $rootCssLoc, $folder;
@ -150,7 +150,6 @@ class SCSSCacher {
} catch(NotFoundException $e) { } catch(NotFoundException $e) {
return false; return false;
} }
return false;
} }
/** /**

View File

@ -21,6 +21,9 @@
namespace OCP; namespace OCP;
use OCP\Files\NotFoundException;
use OCP\Files\SimpleFS\ISimpleFile;
/** /**
* This class provides scss functionality * This class provides scss functionality
* @since 11.0.0 * @since 11.0.0
@ -34,6 +37,7 @@ interface ICssManager {
* @param string $fileName css filename with extension * @param string $fileName css filename with extension
* @param string $appName css app name * @param string $appName css app name
* @return ISimpleFile * @return ISimpleFile
* @throws NotFoundException
*/ */
public function getCss($fileName, $appName); public function getCss($fileName, $appName);
} }