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

eliashaeussler / typo3-warming / 14669983027

25 Apr 2025 05:19PM UTC coverage: 91.991% (+0.01%) from 91.981%
14669983027

push

github

eliashaeussler
[TASK] Ignore .qlty directory in archives

1206 of 1311 relevant lines covered (91.99%)

9.28 hits per line

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

93.75
/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 EliasHaeussler\Typo3Warming\Configuration;
28
use GuzzleHttp\Client;
29
use GuzzleHttp\ClientInterface;
30
use Psr\EventDispatcher;
31
use TYPO3\CMS\Core;
32

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

44
    public function __construct(
7✔
45
        private readonly Configuration\Configuration $configuration,
46
        private readonly Core\Http\Client\GuzzleClientFactory $guzzleClientFactory,
47
        private readonly EventDispatcher\EventDispatcherInterface $eventDispatcher,
48
    ) {}
7✔
49

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

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

62
        $configFromClient = $this->getClientConfigFromReflection($this->client);
7✔
63
        $configFromExtension = $this->configuration->getClientOptions();
7✔
64

65
        Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($configFromClient, $configFromExtension);
7✔
66

67
        return $configFromClient;
7✔
68
    }
69

70
    /**
71
     * @return array<string, mixed>
72
     */
73
    private function getClientConfigFromReflection(ClientInterface $client): array
7✔
74
    {
75
        if (!($client instanceof Client)) {
7✔
76
            return [];
×
77
        }
78

79
        $reflection = new \ReflectionObject($client);
7✔
80
        $property = $reflection->getProperty('config');
7✔
81

82
        return $property->getValue($client);
7✔
83
    }
84
}
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

© 2026 Coveralls, Inc