SolrClient   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 9
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of Solr Client Symfony package.
7
 *
8
 * (c) ingatlan.com Zrt. <[email protected]>
9
 *
10
 * This source file is subject to the MIT license that is bundled
11
 * with this source code in the file LICENSE.
12
 */
13
14
namespace iCom\SolrClient;
15
16
use iCom\SolrClient\Client\SymfonyClient;
17
use Symfony\Component\HttpClient\HttpClient;
18
19
final class SolrClient
20
{
21
    public static function create(array $options): Client
22
    {
23
        if (class_exists(HttpClient::class)) {
24
            return new SymfonyClient(HttpClient::create($options));
25
        }
26
27
        throw new \LogicException('You need to install an HTTP client implementation. Try running "composer require symfony/http-client".');
28
    }
29
}
30