add constructor property promotion
All checks were successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/push/security Pipeline was successful
ci/woodpecker/pr/security Pipeline was successful

add return type of methods
This commit is contained in:
Simon Vieille 2024-06-27 20:27:31 +02:00
commit 7c5654f3bc
Signed by: deblan
GPG key ID: 579388D585F70417
14 changed files with 77 additions and 387 deletions

View file

@ -32,49 +32,26 @@ use OCP\IUserSession;
class CssController extends Controller
{
/**
* @var ConfigProxy
*/
protected $config;
/**
* @var User
*/
protected $user;
/**
* @var ThemingDefaults
*/
protected $theming;
/**
* @var Color
*/
protected $color;
protected ?User $user;
public function __construct(
string $appName,
IRequest $request,
ConfigProxy $config,
ThemingDefaults $theming,
Color $color
protected ConfigProxy $config,
protected ThemingDefaults $theming,
protected Color $color
) {
parent::__construct($appName, $request);
$this->user = OC::$server[IUserSession::class]->getUser();
$this->config = $config;
$this->theming = $theming;
$this->color = $color;
}
/**
* @NoAdminRequired
* @NoCSRFRequired
* @PublicPage
*
* @return Response
*/
public function stylesheet()
public function stylesheet(): TemplateResponse
{
$response = new TemplateResponse(Application::APP_ID, 'css/stylesheet', $this->getConfig(), 'blank');
$response->addHeader('Content-Type', 'text/css');
@ -107,15 +84,15 @@ class CssController extends Controller
$isDarkThemeUserEnabled = 'dark' === $this->config->getUserValue($this->user, 'theme', '', 'accessibility');
$isBreezeDarkUserEnabled = $this->config->getUserValue($this->user, 'theme_enabled', '', 'breezedark');
$isBreezeDarkUserEnabled = '1' === $isBreezeDarkUserEnabled ||
($isBreezeDarkGlobalEnabled && '' === $isBreezeDarkUserEnabled);
$isBreezeDarkUserEnabled = '1' === $isBreezeDarkUserEnabled
|| ($isBreezeDarkGlobalEnabled && '' === $isBreezeDarkUserEnabled);
} else {
$isDarkThemeUserEnabled = false;
$isBreezeDarkUserEnabled = false;
}
$isDarkMode = ($isAccessibilityAppEnabled && $isDarkThemeUserEnabled) ||
($isBreezeDarkAppEnabled && $isBreezeDarkUserEnabled);
$isDarkMode = ($isAccessibilityAppEnabled && $isDarkThemeUserEnabled)
|| ($isBreezeDarkAppEnabled && $isBreezeDarkUserEnabled);
$primaryColor = $this->theming->getColorPrimary();
$lightenPrimaryColor = $this->color->adjustBrightness($primaryColor, 0.2);