Completed
Push — master ( fbdcb5...b8714e )
by Tomáš
36:22 queued 33:21
created

EnableFiltersSubscriber   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 30
ccs 9
cts 9
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setFilterManager() 0 4 1
A getSubscribedEvents() 0 7 1
A enableFilters() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of Zenify
7
 * Copyright (c) 2012 Tomas Votruba (http://tomasvotruba.cz)
8
 */
9
10
namespace Zenify\DoctrineFilters\EventSubscriber;
11
12
use Symfony\Component\Console\ConsoleEvents;
13
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
14
use Symnedi\EventDispatcher\NetteApplicationEvents;
15
use Zenify\DoctrineFilters\Contract\FilterManagerInterface;
16
17
18
final class EnableFiltersSubscriber implements EventSubscriberInterface
19
{
20
21
	/**
22
	 * @var FilterManagerInterface
23
	 */
24
	private $filterManager;
25
26
27 3
	public function setFilterManager(FilterManagerInterface $filterManager)
28
	{
29 3
		$this->filterManager = $filterManager;
30 3
	}
31
32
33 3
	public static function getSubscribedEvents() : array
34
	{
35
		return [
36 3
			ConsoleEvents::COMMAND => 'enableFilters',
37 3
			NetteApplicationEvents::ON_PRESENTER => 'enableFilters'
38
		];
39
	}
40
41
42 1
	public function enableFilters()
43
	{
44 1
		$this->filterManager->enableFilters();
45 1
	}
46
47
}
48