PluginProbe
Authorizer / 3.6.0
Authorizer v3.6.0
3.15.3 3.15.2 3.15.1 3.15.0 3.14.3 3.14.4 3.14.2 3.14.1 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.9.0 2.9.1 2.9.10 2.9.11 2.9.12 2.9.13 2.9.2 2.9.3 2.9.6 All 126 releases
← All changes | vendor/google/auth/src/HttpHandler/HttpHandlerFactory.php +9 -15 3.14.23.6.0 View file →
@@ -15,15 +15,13 @@
15 15 * limitations under the License.
16 16 */
17 17 namespace Google\Auth\HttpHandler;
18 18
19 -use Google\Auth\ApplicationDefaultCredentials;
20 19 use GuzzleHttp\BodySummarizer;
21 20 use GuzzleHttp\Client;
22 21 use GuzzleHttp\ClientInterface;
23 22 use GuzzleHttp\HandlerStack;
24 23 use GuzzleHttp\Middleware;
25 -use Psr\Log\LoggerInterface;
26 24
27 25 class HttpHandlerFactory
28 26 {
29 27 /**
@@ -28,17 +26,14 @@
28 26 {
29 27 /**
30 28 * Builds out a default http handler for the installed version of guzzle.
31 29 *
32 - * @param ClientInterface|null $client
33 - * @param null|false|LoggerInterface $logger
34 - * @return Guzzle6HttpHandler|Guzzle7HttpHandler
30 + * @param ClientInterface $client
31 + * @return Guzzle5HttpHandler|Guzzle6HttpHandler|Guzzle7HttpHandler
35 32 * @throws \Exception
36 33 */
37 - public static function build(
38 - ?ClientInterface $client = null,
39 - null|false|LoggerInterface $logger = null,
40 - ) {
34 + public static function build(ClientInterface $client = null)
35 + {
41 36 if (is_null($client)) {
42 37 $stack = null;
43 38 if (class_exists(BodySummarizer::class)) {
44 39 // double the # of characters before truncation by default
@@ -49,24 +44,23 @@
49 44 }
50 45 $client = new Client(['handler' => $stack]);
51 46 }
52 47
53 - $logger = ($logger === false)
54 - ? null
55 - : $logger ?? ApplicationDefaultCredentials::getDefaultLogger();
56 -
57 48 $version = null;
58 49 if (defined('GuzzleHttp\ClientInterface::MAJOR_VERSION')) {
59 50 $version = ClientInterface::MAJOR_VERSION;
60 51 } elseif (defined('GuzzleHttp\ClientInterface::VERSION')) {
52 + /** @phpstan-ignore-next-line */
61 53 $version = (int) substr(ClientInterface::VERSION, 0, 1);
62 54 }
63 55
64 56 switch ($version) {
57 + case 5:
58 + return new Guzzle5HttpHandler($client);
65 59 case 6:
66 - return new Guzzle6HttpHandler($client, $logger);
60 + return new Guzzle6HttpHandler($client);
67 61 case 7:
68 - return new Guzzle7HttpHandler($client, $logger);
62 + return new Guzzle7HttpHandler($client);
69 63 default:
70 64 throw new \Exception('Version not supported');
71 65 }
72 66 }