EnableFiltersSubscriber::setFilterManager()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 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 Symplify\SymfonyEventDispatcher\Adapter\Nette\Event\ApplicationStartupEvent;
15
use Symplify\SymfonyEventDispatcher\Adapter\Nette\Event\PresenterCreatedEvent;
16
use Zenify\DoctrineFilters\Contract\FilterManagerInterface;
17
18
19
final class EnableFiltersSubscriber implements EventSubscriberInterface
20
{
21
22
	/**
23
	 * @var FilterManagerInterface
24
	 */
25
	private $filterManager;
26
27
28 3
	public function setFilterManager(FilterManagerInterface $filterManager)
29
	{
30 3
		$this->filterManager = $filterManager;
31 3
	}
32
33
34 3
	public static function getSubscribedEvents() : array
35
	{
36
		return [
37 3
			ConsoleEvents::COMMAND => 'enableFilters',
38 3
			ApplicationStartupEvent::NAME => 'enableFilters'
39
		];
40
	}
41
42
43 3
	public function enableFilters()
44
	{
45 3
		$this->filterManager->enableFilters();
46 3
	}
47
48
}
49