Completed
Push — ezp25003-trash_subitems_count_... ( 8a8898 )
by André
34:44
created

RecoverSlot   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 12
rs 10
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A supports() 0 4 1
A extractLocationIds() 0 4 1
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\MVC\Symfony\Cache\Http\SignalSlot;
12
13
use eZ\Publish\Core\SignalSlot\Signal;
14
15
/**
16
 * A slot handling RecoverSignal.
17
 */
18
class RecoverSlot extends PurgeForContentHttpCacheSlot
19
{
20
    protected function supports(Signal $signal)
21
    {
22
        return $signal instanceof Signal\TrashService\RecoverSignal;
23
    }
24
25
    protected function extractLocationIds(Signal $signal)
26
    {
27
        return [$signal->newParentLocationId];
0 ignored issues
show
Documentation introduced by
The property newParentLocationId does not exist on object<eZ\Publish\Core\SignalSlot\Signal>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
28
    }
29
}
30