changed keyword order

This commit is contained in:
Pablo Ferreiro 2023-04-27 20:23:23 +02:00
parent e43580f3f9
commit 19a2066fc2
No known key found for this signature in database
GPG key ID: 41FBCE65B779FA24
15 changed files with 41 additions and 40 deletions

View file

@ -4,14 +4,14 @@ namespace App\Helpers;
use App\Constants\Themes;
class Cookies {
static public function get(string $name, string $default_value = ''): string {
public static function get(string $name, string $default_value = ''): string {
if (isset($_COOKIE[$name]) && !empty($_COOKIE[$name])) {
return $_COOKIE[$name];
}
return $default_value;
}
static public function theme(): string {
public static function theme(): string {
$theme = self::get('theme');
$ref = new \ReflectionClass(Themes::class);
$themes = $ref->getConstants();
@ -21,20 +21,20 @@ class Cookies {
return 'default';
}
static public function downloader(): string {
public static function downloader(): string {
$downloader = self::get('api-downloader', 'default');
return $downloader;
}
static public function exists(string $name): bool {
public static function exists(string $name): bool {
return isset($_COOKIE[$name]);
}
static public function check(string $name, string $value): bool {
public static function check(string $name, string $value): bool {
return self::exists($name) && $_COOKIE[$name] === $value;
}
static public function set(string $name, string $value) {
public static function set(string $name, string $value) {
setcookie($name, $value, time()+60*60*24*30, '/', '', isset($_SERVER['HTTPS']), true);
}
};