فهرست منبع

fix: code style

Anankke 3 ماه پیش
والد
کامیت
dda9101b95
2فایلهای تغییر یافته به همراه14 افزوده شده و 14 حذف شده
  1. 2 2
      resources/views/tabler/user/index.tpl
  2. 12 12
      src/Services/Config/ClientConfig.php

+ 2 - 2
resources/views/tabler/user/index.tpl

@@ -335,7 +335,7 @@
                         </div>
                         <div class="card-footer">
                             <div class="d-flex">
-                                {if ! $user->isAbleToCheckin()}
+                                {if !$user->isAbleToCheckin()}
                                 <button id="check-in" class="btn btn-primary ms-auto" disabled>已签到</button>
                                 {else}
                                 {if $public_setting['enable_checkin_captcha']}
@@ -784,4 +784,4 @@
     {/literal}
     </script>
 
-    {include file='user/footer.tpl'}
+    {include file='user/footer.tpl'}

+ 12 - 12
src/Services/Config/ClientConfig.php

@@ -4,10 +4,10 @@ declare(strict_types=1);
 
 namespace App\Services\Config;
 
-class ClientConfig
+final class ClientConfig
 {
     private static ?array $config = null;
-    
+
     public static function getClients(string $sub, string $name, bool $r2): array
     {
         if (self::$config === null) {
@@ -15,19 +15,19 @@ class ClientConfig
             if (!is_readable($file)) {
                 throw new \RuntimeException("Client config file not found: {$file}");
             }
-            
+
             $content = file_get_contents($file);
             if ($content === false) {
                 throw new \RuntimeException("Failed to read client config file: {$file}");
             }
-            
+
             try {
                 self::$config = json_decode($content, true, 512, JSON_THROW_ON_ERROR);
             } catch (\JsonException $e) {
-                throw new \RuntimeException("Invalid JSON in client config file: " . $e->getMessage());
+                throw new \RuntimeException('Invalid JSON in client config file: ' . $e->getMessage());
             }
         }
-        
+
         $result = [];
         foreach (self::$config['clients'] as $client) {
             foreach ($client['platforms'] as $platform => $data) {
@@ -36,17 +36,17 @@ class ClientConfig
                     'description' => $data['desc'] ?? $client['description'],
                     'format' => $client['format'],
                     'importUrl' => str_replace(
-                        ['{sub}', '{name}'], 
-                        [$sub, rawurlencode($name)], 
+                        ['{sub}', '{name}'],
+                        [$sub, rawurlencode($name)],
                         $data['importUrl'] ?? $client['importUrl']
                     ),
-                    'downloadUrl' => isset($data['storeUrl']) ? $data['storeUrl'] :
-                        (isset($data['ext']) ? ($r2 ? '/user' : '') . "/clients/" . ($data['file'] ?? str_replace(' ', '.', $client['name'])) . ".{$data['ext']}" : ''),
-                    'isAppStore' => isset($data['storeUrl'])
+                    'downloadUrl' => $data['storeUrl'] ??
+                        (isset($data['ext']) ? ($r2 ? '/user' : '') . '/clients/' . ($data['file'] ?? str_replace(' ', '.', $client['name'])) . ".{$data['ext']}" : ''),
+                    'isAppStore' => isset($data['storeUrl']),
                 ];
             }
         }
-        
+
         return ['clients' => $result, 'icons' => self::$config['icons']];
     }
 }