Completed
Push — master ( 464304...ae781e )
by Jean
05:57
created

ElasticSearchWriter::configureIndex()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * @author Jean Silva <[email protected]>
4
 * @license MIT
5
 */
6
namespace Jeancsil\FlightSpy\History\ElasticSearch;
7
8
use Jeancsil\FlightSpy\Service\ElasticSearch\Client;
9
10
class ElasticSearchWriter extends ResultWriter
11
{
12
    /**
13
     * @var string
14
     */
15
    protected $indexName;
16
17
    /**
18
     * @var string
19
     */
20
    protected $typeName;
21
22
    public function write(array $response)
23
    {
24
        $params = [
25
            'index' => $this->indexName,
26
            'type' => $this->typeName,
27
//            'id' => 'my_id',
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
28
            'body' => $response
29
        ];
30
31
        $response = Client::getInstance()
0 ignored issues
show
Coding Style introduced by
Consider using a different name than the parameter $response. This often makes code more readable.
Loading history...
32
            ->index($params);
33
34
        print_r($response);
35
    }
36
37
    public function configureIndex($indexName) {
38
        $this->indexName = $indexName;
39
    }
40
41
    public function configureType($typeName) {
42
        $this->typeName = $typeName;
43
    }
44
}
45