Code cleanup
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
1f769e6e76
commit
2816177ecb
5 changed files with 12 additions and 16 deletions
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue