Completed
Push — EZP-25088-search-handler-inter... ( 170b1b...34d2d2 )
by
unknown
18:19
created

HideLocation::receive()   B

Complexity

Conditions 6
Paths 3

Size

Total Lines 16
Code Lines 9

Duplication

Lines 16
Ratio 100 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 6
eloc 9
c 2
b 0
f 0
nc 3
nop 1
dl 16
loc 16
rs 8.8571
1
<?php
2
3
/**
4
 * This file is part of the eZ Publish Kernel package.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 *
9
 * @version //autogentag//
10
 */
11
namespace eZ\Publish\Core\Search\Common\Slot;
12
13
use eZ\Publish\Core\SignalSlot\Signal;
14
use eZ\Publish\Core\Search\Common\Slot;
15
use eZ\Publish\SPI\Search\Indexing\ContentIndexing;
16
use eZ\Publish\SPI\Search\Indexing\FullTextIndexing;
17
use eZ\Publish\SPI\Search\Indexing\LocationIndexing;
18
19
/**
20
 * A Search Engine slot handling HideLocationSignal.
21
 */
22 View Code Duplication
class HideLocation extends AbstractSubtree
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...
23
{
24
    /**
25
     * Receive the given $signal and react on it.
26
     *
27
     * @param \eZ\Publish\Core\SignalSlot\Signal $signal
28
     */
29
    public function receive(Signal $signal)
30
    {
31
        if (!$signal instanceof Signal\LocationService\HideLocationSignal || !$this->canIndex()) {
32
            return;
33
        }
34
35
        if (
36
            $this->searchHandler instanceof FullTextIndexing &&
37
            !$this->searchHandler instanceof ContentIndexing &&
38
            !$this->searchHandler instanceof LocationIndexing
39
        ) {
40
            return;
41
        }
42
43
        $this->indexSubtree($signal->locationId);
44
    }
45
}
46