Completed
Push — travis_trusty ( e78e49...6f0d6f )
by André
54:54 queued 34:46
created

UpdateLocation::receive()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 21
Code Lines 11

Duplication

Lines 21
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 11
c 1
b 0
f 0
nc 2
nop 1
dl 21
loc 21
rs 9.3142
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
16
/**
17
 * A Search Engine slot handling UpdateLocationSignal.
18
 */
19 View Code Duplication
class UpdateLocation extends Slot
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...
20
{
21
    /**
22
     * Receive the given $signal and react on it.
23
     *
24
     * @param \eZ\Publish\Core\SignalSlot\Signal $signal
25
     */
26
    public function receive(Signal $signal)
27
    {
28
        if (!$signal instanceof Signal\LocationService\UpdateLocationSignal) {
29
            return;
30
        }
31
32
        $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo(
33
            $signal->contentId
34
        );
35
36
        $this->searchHandler->indexContent(
37
            $this->persistenceHandler->contentHandler()->load(
38
                $signal->contentId,
39
                $contentInfo->currentVersionNo
40
            )
41
        );
42
43
        $this->searchHandler->indexLocation(
44
            $this->persistenceHandler->locationHandler()->load($signal->locationId)
45
        );
46
    }
47
}
48