LogicalAnd::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
dl 12
loc 12
c 0
b 0
f 0
rs 9.8666
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Kaliop\EzFindSearchEngineBundle\Core\Persistence\eZFind\Content\Search\Common\Gateway\CriterionHandler;
4
5
use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
6
use Kaliop\EzFindSearchEngineBundle\Core\Persistence\eZFind\Content\Search\Common\Gateway\CriteriaConverter;
7
use Kaliop\EzFindSearchEngineBundle\Core\Persistence\eZFind\Content\Search\Common\Gateway\CriterionHandler;
8
use Kaliop\EzFindSearchEngineBundle\Persistence\Solr\Content\Search\CriterionVisitor;
9
use Kaliop\EzFindSearchEngineBundle\Persistence\Solr\Content\Search\CriterionVisitorDispatcher as Dispatcher;
10
11 View Code Duplication
class LogicalAnd extends CriterionHandler
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
    public function accept(Criterion $criterion)
14
    {
15
        return $criterion instanceof Criterion\LogicalAnd;
16
    }
17
18
    public function handle(CriteriaConverter $converter, Criterion $criterion)
19
    {
20
        return array_merge(
21
            array('AND'),
22
            array_map(
23
                function ($value) use ($converter) {
24
                    return $converter->handle($value);
25
                },
26
                $criterion->criteria
0 ignored issues
show
Bug introduced by
The property criteria does not seem to exist in eZ\Publish\API\Repositor...Content\Query\Criterion.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
27
            )
28
        );
29
    }
30
}
31