Use temporary variables for `Request` objects in FontManager
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 6 Jul 2021 10:49:19 +0000 (12:49 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 6 Jul 2021 10:49:19 +0000 (12:49 +0200)
This is for consistency with other code sending HTTP requests and to shorten
the lines, as one of them exceeded 120 characters.

wcfsetup/install/files/lib/system/style/FontManager.class.php

index 58466c4c874ce254d96b2e7cf6b71c0aae6268e4..4dc25d21103cabd12921fafedca01df6cb8d1961 100644 (file)
@@ -69,7 +69,8 @@ class FontManager extends SingletonFactory
      */
     public function fetchAvailableFamilies()
     {
-        $response = $this->http->send(new Request('GET', 'families.json'));
+        $request = new Request('GET', 'families.json');
+        $response = $this->http->send($request);
 
         return JSON::decode($response->getBody());
     }
@@ -84,7 +85,8 @@ class FontManager extends SingletonFactory
     public function downloadFamily($family)
     {
         try {
-            $response = $this->http->send(new Request('GET', \rawurlencode($family) . '/manifest.json'));
+            $request = new Request('GET', \rawurlencode($family) . '/manifest.json');
+            $response = $this->http->send($request);
             $manifest = JSON::decode($response->getBody());
 
             $familyDirectory = \dirname($this->getCssFilename($family));
@@ -103,7 +105,8 @@ class FontManager extends SingletonFactory
                     throw new \InvalidArgumentException("Invalid filename '" . $filename . "' given.");
                 }
 
-                $response = $this->http->send(new Request('GET', \rawurlencode($family) . '/' . \rawurlencode($filename)));
+                $request = new Request('GET', \rawurlencode($family) . '/' . \rawurlencode($filename));
+                $response = $this->http->send($request);
 
                 $file = new AtomicWriter($familyDirectory . '/' . $filename);
                 while (!$response->getBody()->eof()) {