Completed
Push — console-tests ( dd5072 )
by Tomáš
11:23
created

EnableFiltersSubscriber   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

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
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
	public function setFilterManager(FilterManagerInterface $filterManager)
28
	{
29
		$this->filterManager = $filterManager;
30
	}
31
32
33
	public static function getSubscribedEvents() : array
34
	{
35
		return [
36
			ConsoleEvents::COMMAND => 'enableFilters',
37
			NetteApplicationEvents::ON_PRESENTER => 'enableFilters'
38
		];
39
	}
40
41
42
	public function enableFilters()
43
	{
44
		$this->filterManager->enableFilters();
45
	}
46
47
}
48