Completed
Push — master ( a063ee...aff5fa )
by
unknown
22:17
created

UpdateUser::receive()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 24

Duplication

Lines 24
Ratio 100 %

Importance

Changes 0
Metric Value
cc 3
nc 3
nop 1
dl 24
loc 24
rs 9.536
c 0
b 0
f 0
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
namespace eZ\Publish\Core\Search\Common\Slot;
10
11
use eZ\Publish\Core\SignalSlot\Signal;
12
use eZ\Publish\Core\Search\Common\Slot;
13
14
/**
15
 * A Search Engine slot handling UpdateUserSignal.
16
 */
17 View Code Duplication
class UpdateUser 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...
18
{
19
    /**
20
     * Receive the given $signal and react on it.
21
     *
22
     * @param \eZ\Publish\Core\SignalSlot\Signal $signal
23
     */
24
    public function receive(Signal $signal)
25
    {
26
        if (!$signal instanceof Signal\UserService\UpdateUserSignal) {
27
            return;
28
        }
29
30
        $userContentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo(
31
            $signal->userId
32
        );
33
34
        $this->searchHandler->indexContent(
35
            $this->persistenceHandler->contentHandler()->load(
36
                $userContentInfo->id,
37
                $userContentInfo->currentVersionNo
38
            )
39
        );
40
41
        $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent(
42
            $userContentInfo->id
43
        );
44
        foreach ($locations as $location) {
45
            $this->searchHandler->indexLocation($location);
46
        }
47
    }
48
}
49