You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.7 KiB

3 years ago
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2016, ownCloud, Inc.
  5. *
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Lukas Reschke <lukas@statuscode.ch>
  8. * @author Roeland Jago Douma <roeland@famdouma.nl>
  9. *
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. namespace OC\Http\Client;
  26. use GuzzleHttp\Client as GuzzleClient;
  27. use OCP\Http\Client\IClient;
  28. use OCP\Http\Client\IClientService;
  29. use OCP\ICertificateManager;
  30. use OCP\IConfig;
  31. use OCP\ILogger;
  32. /**
  33. * Class ClientService
  34. *
  35. * @package OC\Http
  36. */
  37. class ClientService implements IClientService {
  38. /** @var IConfig */
  39. private $config;
  40. /** @var ILogger */
  41. private $logger;
  42. /** @var ICertificateManager */
  43. private $certificateManager;
  44. public function __construct(IConfig $config,
  45. ILogger $logger,
  46. ICertificateManager $certificateManager) {
  47. $this->config = $config;
  48. $this->logger = $logger;
  49. $this->certificateManager = $certificateManager;
  50. }
  51. /**
  52. * @return Client
  53. */
  54. public function newClient(): IClient {
  55. return new Client($this->config, $this->logger, $this->certificateManager, new GuzzleClient());
  56. }
  57. }