Passed
Push — master ( fb70ba...785b5c )
by
unknown
34:59
created

RequestFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 18
ccs 0
cts 8
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A request() 0 5 1
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
18
namespace ApacheSolrForTypo3\Solr\System\Solr;
19
20
use GuzzleHttp\Client as GuzzleClient;
21
use Psr\Http\Message\ResponseInterface;
22
use TYPO3\CMS\Core\Http\RequestFactory as CoreRequestFactory;
23
use TYPO3\CMS\Core\Utility\GeneralUtility;
24
25
class RequestFactory extends CoreRequestFactory
26
{
27
    protected $clientOptions = [];
28
29
    /**
30
     * RequestFactory constructor.
31
     * @param array $clientOptions
32
     */
33
    public function __construct(array $clientOptions)
34
    {
35
        $this->clientOptions = $clientOptions;
36
    }
37
38
    public function request(string $uri, string $method = 'GET', array $options = []): ResponseInterface
39
    {
40
        /* @var GuzzleClient $client */
41
        $client = GeneralUtility::makeInstance(GuzzleClient::class, $this->clientOptions);
42
        return $client->request($method, $uri, $options);
43
    }
44
}
45