Completed
Push — master ( 87a78f...b306f9 )
by André
97:52 queued 72:52
created

RecoverSlot::supports()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
cc 1
eloc 2
nc 1
nop 1
rs 10
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\MVC\Symfony\Cache\Http\SignalSlot;
10
11
use eZ\Publish\Core\SignalSlot\Signal;
12
13
/**
14
 * A slot handling RecoverSignal.
15
 */
16
class RecoverSlot extends PurgeForContentHttpCacheSlot
17
{
18
    protected function supports(Signal $signal)
19
    {
20
        return $signal instanceof Signal\TrashService\RecoverSignal;
21
    }
22
23
    protected function extractLocationIds(Signal $signal)
24
    {
25
        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...
26
    }
27
}
28