• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

eliashaeussler / typo3-warming / 14534307929

18 Apr 2025 11:15AM UTC coverage: 91.827% (-0.2%) from 92.065%
14534307929

Pull #769

github

eliashaeussler
[!!!][TASK] Drop support for PHP 8.1
Pull Request #769: [!!!][FEATURE] Require `eliashaeussler/cache-warmup` ^4.0

85 of 90 new or added lines in 12 files covered. (94.44%)

2 existing lines in 1 file now uncovered.

1191 of 1297 relevant lines covered (91.83%)

9.29 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.31
/Classes/Http/Client/ClientBridge.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the TYPO3 CMS extension "warming".
7
 *
8
 * Copyright (C) 2021-2025 Elias Häußler <elias@haeussler.dev>
9
 *
10
 * This program is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation, either version 2 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22
 */
23

24
namespace EliasHaeussler\Typo3Warming\Http\Client;
25

26
use EliasHaeussler\CacheWarmup;
27
use GuzzleHttp\Client;
28
use GuzzleHttp\ClientInterface;
29
use Psr\EventDispatcher;
30
use TYPO3\CMS\Core;
31

32
/**
33
 * ClientBridge
34
 *
35
 * @author Elias Häußler <elias@haeussler.dev>
36
 * @license GPL-2.0-or-later
37
 * @internal
38
 */
39
final class ClientBridge
40
{
41
    private ?ClientInterface $client = null;
42

43
    public function __construct(
25✔
44
        private readonly Core\Http\Client\GuzzleClientFactory $guzzleClientFactory,
45
        private readonly EventDispatcher\EventDispatcherInterface $eventDispatcher,
46
    ) {}
25✔
47

48
    public function getClientFactory(): CacheWarmup\Http\Client\ClientFactory
24✔
49
    {
50
        return new CacheWarmup\Http\Client\ClientFactory($this->eventDispatcher, $this->getClientConfig());
24✔
51
    }
52

53
    /**
54
     * @return array<string, mixed>
55
     */
56
    public function getClientConfig(): array
25✔
57
    {
58
        $this->client ??= $this->guzzleClientFactory->getClient();
25✔
59

60
        return $this->getClientConfigFromReflection($this->client);
25✔
61
    }
62

63
    /**
64
     * @return array<string, mixed>
65
     */
66
    private function getClientConfigFromReflection(ClientInterface $client): array
25✔
67
    {
68
        if (!($client instanceof Client)) {
25✔
NEW
69
            return [];
×
70
        }
71

72
        $reflection = new \ReflectionObject($client);
25✔
73
        $property = $reflection->getProperty('config');
25✔
74

75
        return $property->getValue($client);
25✔
76
    }
77
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc