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...
10
{
11
/**
12
* @var bool
13
*/
14
private $registered;
15
16
/**
17
* @override
18
* @inheritDoc
19
*/
20
4
public function registerPlugin(SimpleFactoryInterface $factory)
21
{
22
try
23
{
24
4
$this->register($factory);
25
3
$this->registered = true;
26
}
27
1
catch (Error $ex)
28
{
29
$this->throwException($ex);
30
}
31
1
catch (Exception $ex)
32
{
33
1
$this->throwException($ex);
34
}
35
36
3
return $this;
37
}
38
39
/**
40
* @override
41
* @inheritDoc
42
*/
43
3
public function unregisterPlugin(SimpleFactoryInterface $factory)
44
{
45
3
if ($this->registered)
46
{
47
1
$this->unregister($factory);
48
1
$this->registered = false;
49
}
50
51
3
return $this;
52
}
53
54
/**
55
* Define how plugin should be registered.
56
*
57
* @param SimpleFactoryInterface $factory
58
*/
59
protected function register(SimpleFactoryInterface $factory)
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.