Completed
Push — EZP-31644 ( 2e0a1e...93bb44 )
by
unknown
19:12
created

SwapLocationSlot::supports()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
rs 10
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\MVC\Symfony\Cache\Http\SignalSlot;
10
11
use eZ\Publish\Core\SignalSlot\Signal;
12
13
/**
14
 * A slot handling SwapLocationSignal.
15
 *
16
 * @deprecated since 6.8. The platform-http-cache package defines slots for http-cache multi-tagging.
17
 */
18
class SwapLocationSlot extends HttpCacheSlot
0 ignored issues
show
Deprecated Code introduced by
The class eZ\Publish\Core\MVC\Symf...ignalSlot\HttpCacheSlot has been deprecated with message: since 6.8. The platform-http-cache package defines slots for http-cache multi-tagging.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
19
{
20
    /**
21
     * Not required by this implementation.
22
     */
23
    protected function extractContentId(Signal $signal)
0 ignored issues
show
Unused Code introduced by
The parameter $signal is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
24
    {
25
        return null;
26
    }
27
28
    protected function supports(Signal $signal)
29
    {
30
        return $signal instanceof Signal\LocationService\SwapLocationSignal;
31
    }
32
33
    /**
34
     * @param \eZ\Publish\Core\SignalSlot\Signal\LocationService\SwapLocationSignal $signal
35
     */
36
    protected function purgeHttpCache(Signal $signal)
37
    {
38
        $this->httpCacheClearer->purgeForContent($signal->content1Id);
0 ignored issues
show
Documentation introduced by
The property content1Id 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...
Deprecated Code introduced by
The method eZ\Publish\Core\MVC\Symf...rger::purgeForContent() has been deprecated with message: in 6.5, design flaw on deleted/trashed content, use purge() when content does not exist for now. See EZP-25696 for potential future feature to solve this.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
39
        $this->httpCacheClearer->purgeForContent($signal->content2Id);
0 ignored issues
show
Documentation introduced by
The property content2Id 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...
Deprecated Code introduced by
The method eZ\Publish\Core\MVC\Symf...rger::purgeForContent() has been deprecated with message: in 6.5, design flaw on deleted/trashed content, use purge() when content does not exist for now. See EZP-25696 for potential future feature to solve this.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
40
    }
41
}
42