Completed
Push — http_cache_slots ( c4b669 )
by
unknown
13:55
created

DeleteLocationSlot::purgeHttpCache()   A

Complexity

Conditions 2
Paths 3

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
c 0
b 0
f 0
nc 3
nop 1
dl 0
loc 11
rs 9.4285
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 DeleteLocationSignal.
15
 */
16 View Code Duplication
class DeleteLocationSlot extends AbstractContentSlot
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...
17
{
18
    /**
19
     * @param \eZ\Publish\Core\SignalSlot\Signal\LocationService\DeleteLocationSignal $signal
20
     */
21
    protected function generateTags(Signal $signal)
22
    {
23
        $tags = parent::generateTags($signal);
24
        $tags[] = 'path-' . $signal->locationId;
0 ignored issues
show
Documentation introduced by
The property locationId 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...
25
26
        return $tags;
27
    }
28
29
    protected function supports(Signal $signal)
30
    {
31
        return $signal instanceof Signal\LocationService\DeleteLocationSignal;
32
    }
33
}
34