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

EnableFiltersSubscriber::enableFilters()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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