Completed
Push — master ( e87e4d...9e3d98 )
by Korvin
02:55
created

LegacyProvider::register()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 10
Code Lines 4

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
dl 10
loc 10
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 4
nc 2
nop 2
1
<?php
2
3
namespace Buttress\Concrete\CommandBus\Provider;
4
5
use Buttress\Concrete\CommandBus\Command\Cache\Clear;
6
use Buttress\Concrete\CommandBus\Command\HandlerLocator;
7
use Buttress\Concrete\CommandBus\Handler\Legacy\CacheHandler;
8
use Buttress\Concrete\Locator\Site;
9
10
/**
11
 * A handler provider for Legacy versions of concrete5
12
 */
13 View Code Duplication
class LegacyProvider implements Provider
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...
14
{
15
16
    public function register(HandlerLocator $locator, Site $site)
17
    {
18
        // If we're not in a concrete5 site, or if we're in a modern site, return
19
        if (!$site || version_compare($site->getVersion(), '5.7.0') > -1) {
20
            return;
21
        }
22
23
        // Add a handler for the "Clear" command
24
        $locator->pushHandler(Clear::class, CacheHandler::class);
25
    }
26
}
27