diff --git a/backend/class/Filesystem.php b/backend/class/Filesystem.php index 42d1b92..ba6efcc 100644 --- a/backend/class/Filesystem.php +++ b/backend/class/Filesystem.php @@ -129,7 +129,7 @@ private function isMovable(string $source, string $destination): bool */ public function fileAvailable(string $file, bool $noCache = null): bool { - $noCache = $noCache ?? false; + $noCache ??= false; if (! $noCache && isset($this->fileCache[$file])) { return $this->fileCache[$file]; } diff --git a/backend/class/Helper/DateHelper.php b/backend/class/Helper/DateHelper.php index 64c5819..a434a51 100644 --- a/backend/class/Helper/DateHelper.php +++ b/backend/class/Helper/DateHelper.php @@ -171,7 +171,7 @@ public static function timeInWords($date, bool $withTime = null): string if (! $date) { return 'N/A'; } - $withTime = $withTime ?? true; + $withTime ??= true; $timestamp = strtotime($date); $distance = round(abs(time() - $timestamp) / 60); if ($distance <= 1) { diff --git a/backend/class/Helper/FilesystemHelper.php b/backend/class/Helper/FilesystemHelper.php index d7f1c67..e8bcd29 100644 --- a/backend/class/Helper/FilesystemHelper.php +++ b/backend/class/Helper/FilesystemHelper.php @@ -1,14 +1,11 @@ ='], $filename); $filename = preg_replace('/[‗≈≡]/u', '=', $filename); $filename = (string)str_replace(['ыЫ', '℅', '₧', '™', '№', 'Ч', '‰'], ['bl', 'c/o', 'Pts', 'tm', 'No', '4', '%'], $filename); @@ -141,75 +138,4 @@ final public static function cleanFilename(string $filename): string return (string)str_replace([',', '_', '/', '\\/', ' '], '', $filename); } - - /** - * I will return file information for the given $fileName. - * - * @param $filename - * - * @return array - */ - #[ArrayShape(['icon_class' => 'string', 'extension' => 'mixed|string', 'category' => 'string'])] public static function getFileInfo($filename): array - { - preg_match('/\.[^\.]+$', $filename, $ext); - $return = [ - 'icon_class' => '', - 'extension' => $ext[0] ?? '', - 'category' => '' - ]; - switch (strtolower($return['extension'])) { - case '.pdf': - case '.doc': - case '.rtf': - case '.txt': - case '.docx': - case '.xls': - case '.xlsx': - $return['icon_class'] = 'file-text'; - $return['category'] = 'document'; - break; - case '.png': - case '.jpg': - case '.jpeg': - case '.gif': - case '.bmp': - case '.psd': - case '.tif': - case '.tiff': - $return['icon_class'] = 'picture'; - $return['category'] = 'image'; - break; - case '.mp3': - case '.wav': - case '.wma': - case '.m4a': - case '.m3u': - $return['icon_class'] = 'music'; - $return['category'] = 'audio'; - break; - case '.3g2': - case '.3gp': - case '.asf': - case '.asx': - case '.avi': - case '.flv': - case '.m4v': - case '.mov': - case '.mp4': - case '.mpg': - case '.srt': - case '.swf': - case '.vob': - case '.wmv': - $return['icon_class'] = 'film'; - $return['category'] = 'video'; - break; - default: - $return['icon_class'] = 'file-binary'; - $return['category'] = 'other'; - break; - } - - return $return; - } } diff --git a/backend/class/Helper/FrontendHelper.php b/backend/class/Helper/FrontendHelper.php index 6fe7019..f620db6 100644 --- a/backend/class/Helper/FrontendHelper.php +++ b/backend/class/Helper/FrontendHelper.php @@ -163,7 +163,6 @@ final public static function parseFile(string $file, mixed $data = null): string return ''; } ob_start(); - /** @noinspection PhpIncludeInspection */ include $file; return ob_get_clean(); diff --git a/backend/class/Request.php b/backend/class/Request.php index 4f3101d..d7b5b6e 100644 --- a/backend/class/Request.php +++ b/backend/class/Request.php @@ -39,8 +39,6 @@ abstract class Request implements RequestInterface * If the single instance does not exist, create it. * Return the single instance then. * - * @noinspection PhpMissingParentCallCommonInspection - * * @return \noxkiwi\core\Request */ public static function getInstance(): static diff --git a/backend/class/Response.php b/backend/class/Response.php index 6cc7636..646d563 100644 --- a/backend/class/Response.php +++ b/backend/class/Response.php @@ -41,8 +41,6 @@ abstract class Response implements ResponseInterface * If the single instance does not exist, create it. * Return the single instance then. * - * @noinspection PhpMissingParentCallCommonInspection - * * @return \noxkiwi\core\Response */ public static function getInstance(): static diff --git a/backend/class/Session/SessionSession.php b/backend/class/Session/SessionSession.php index 3a32477..7dcfe67 100644 --- a/backend/class/Session/SessionSession.php +++ b/backend/class/Session/SessionSession.php @@ -128,7 +128,7 @@ public function remove(string $key): void */ public function exists(string $key): bool { - return array_key_exists($key, $_SESSION); + return array_key_exists($key, $_SESSION ?? []); } /**