AdapterFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 15
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 12 1
1
<?php
2
3
namespace Pgs\ElasticOM;
4
5
use Doctrine\Common\Annotations\AnnotationRegistry;
6
use Elasticsearch\ClientBuilder;
7
8
class AdapterFactory
9
{
10 1
    public static function create(string $host, int $port, string $index): Adapter
11
    {
12 1
        AnnotationRegistry::registerLoader('class_exists');
13
14 1
        return new Adapter(
15 1
            ClientBuilder::create()
16 1
                ->setSerializer(new JsonSerializer())
17 1
                ->setHosts(["$host:$port"])
18 1
                ->build(),
19
            $index
20
        );
21
    }
22
}
23