Completed
Push — master ( 68be21...073c54 )
by Kévin
02:41
created

Elastica::supports()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 3
eloc 2
nc 3
nop 2
1
<?php
2
3
namespace RulerZ\Target\Elastica;
4
5
use Elastica\Search;
6
use Elastica\SearchableInterface;
7
use FOS\ElasticaBundle\Finder\TransformedFinder;
8
9
use RulerZ\Compiler\Context;
10
use RulerZ\Target\AbstractCompilationTarget;
11
use RulerZ\Target\GenericElasticsearchVisitor;
12
use RulerZ\Target\Operators\GenericElasticsearchDefinitions;
13
14
class Elastica extends AbstractCompilationTarget
15
{
16
    /**
17
     * {@inheritDoc}
18
     */
19
    public function supports($target, $mode)
20
    {
21
        return $target instanceof SearchableInterface || $target instanceof TransformedFinder || $target instanceof Search;
0 ignored issues
show
Bug introduced by
The class FOS\ElasticaBundle\Finder\TransformedFinder does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
22
    }
23
24
    /**
25
     * @inheritDoc
26
     */
27
    protected function createVisitor(Context $context)
28
    {
29
        return new GenericElasticsearchVisitor($this->getOperators());
30
    }
31
32
    /**
33
     * @inheritDoc
34
     */
35
    protected function getExecutorTraits()
36
    {
37
        return [
38
            '\RulerZ\Executor\Elasticsearch\ElasticaFilterTrait',
39
            '\RulerZ\Executor\Polyfill\FilterBasedSatisfaction',
40
        ];
41
    }
42
43
    /**
44
     * @inheritDoc
45
     */
46
    public function getOperators()
47
    {
48
        return GenericElasticsearchDefinitions::create(parent::getOperators());
49
    }
50
}
51