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

RequestFactory::request()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
ccs 0
cts 4
cp 0
rs 10
cc 1
nc 1
nop 3
crap 2
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