ElasticSearchRequester::wasNotified()   B
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 25
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 25
ccs 0
cts 22
cp 0
rs 8.8571
c 0
b 0
f 0
cc 2
eloc 14
nc 2
nop 2
crap 6
1
<?php
2
namespace Jeancsil\FlightSpy\Service\ElasticSearch;
3
4
/**
5
 * @author Jean Silva <[email protected]>
6
 * @license MIT
7
 */
8
class ElasticSearchRequester
9
{
10
    use ConfiguratorTrait;
11
12
    /**
13
     * @param string $identifier
14
     * @param string $notifyTo
15
     * @return boolean
16
     */
17
    public function wasNotified($identifier, $notifyTo)
0 ignored issues
show
Coding Style introduced by
function wasNotified() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
18
    {
19
        $params = [
20
            'index' => $this->indexName,
21
            'type' => $this->typeName,
22
            'body' => [
23
                'query' => [
24
                    'bool' => [
25
                        'must' => [
26
                            ['term' => ['identifier' => $identifier]],
27
                            ['term' => ['notified' => $notifyTo]]
28
                        ]
29
                    ]
30
                ]
31
            ]
32
        ];
33
34
        $response = Client::getInstance()->search($params);
35
36
        if (isset($response['hits']['total'])) {
37
            return $response['hits']['total'] > 0;
38
        }
39
40
        return false;
41
    }
42
}
43