‪TYPO3CMS  ‪main
GuzzleClientFactory.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use GuzzleHttp\Client;
21 use GuzzleHttp\ClientInterface;
22 use GuzzleHttp\HandlerStack;
23 
28 {
32  public function ‪getClient(): ClientInterface
33  {
34  $httpOptions = ‪$GLOBALS['TYPO3_CONF_VARS']['HTTP'];
35  $httpOptions['verify'] = filter_var($httpOptions['verify'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) ?? $httpOptions['verify'];
36 
37  if (isset(‪$GLOBALS['TYPO3_CONF_VARS']['HTTP']['handler']) && is_array(‪$GLOBALS['TYPO3_CONF_VARS']['HTTP']['handler'])) {
38  $stack = HandlerStack::create();
39  foreach (‪$GLOBALS['TYPO3_CONF_VARS']['HTTP']['handler'] ?? [] as $name => $handler) {
40  $stack->push($handler, (string)$name);
41  }
42  $httpOptions['handler'] = $stack;
43  }
44 
45  return new Client($httpOptions);
46  }
47 }
‪TYPO3\CMS\Core\Http\Client\GuzzleClientFactory\getClient
‪getClient()
Definition: GuzzleClientFactory.php:32
‪TYPO3\CMS\Core\Http\Client\GuzzleClientFactory
Definition: GuzzleClientFactory.php:28
‪TYPO3\CMS\Core\Http\Client
Definition: GuzzleClientFactory.php:18
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25