Completed
Push — master ( a18119...0d7bb7 )
by Peter
05:52
created

FinderHelpers::setScopeManager()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 3
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Maslosoft\Mangan\Traits\Finder;
4
5
use Maslosoft\Mangan\Interfaces\Adapters\FinderAdapterInterface;
6
use Maslosoft\Mangan\Interfaces\FinderEventsInterface;
7
use Maslosoft\Mangan\Interfaces\ProfilerInterface;
8
use Maslosoft\Mangan\Interfaces\ScopeManagerInterface;
9
use Maslosoft\Mangan\Profillers\NullProfiler;
10
11
/**
12
 * FinderHelpers
13
 *
14
 * @author Piotr Maselkowski <pmaselkowski at gmail.com>
15
 */
16
trait FinderHelpers
17
{
18
19
	/**
20
	 *
21
	 * @var FinderAdapterInterface
22
	 */
23
	private $adapter = null;
24
25
	/**
26
	 * Scope manager instance
27
	 * @var ScopeManagerInterface
28
	 */
29
	private $scopeManager = null;
30
31
	/**
32
	 * Finder events instance.
33
	 *
34
	 * This must hold events helper
35
	 *
36
	 * @var FinderEventsInterface
37
	 */
38
	private $finderEvents = null;
39
40
	/**
41
	 * Profiler instance
42
	 * @var ProfilerInterface
43
	 */
44
	private $profiler = null;
45
46
	public function getAdapter()
47
	{
48
		return $this->adapter;
49
	}
50
51
	public function getScopeManager()
52
	{
53
		return $this->scopeManager;
54
	}
55
56
	public function getFinderEvents()
57
	{
58
		return $this->finderEvents;
59
	}
60
61
	public function getProfiler()
62
	{
63
		if (empty($this->profiler))
64
		{
65
			$this->profiler = new NullProfiler();
66
		}
67
		return $this->profiler;
68
	}
69
70
	public function setAdapter(FinderAdapterInterface $adapter)
71
	{
72
		$this->adapter = $adapter;
73
		return $this;
74
	}
75
76
	public function setScopeManager(ScopeManagerInterface $scopeManager)
77
	{
78
		$this->scopeManager = $scopeManager;
79
		return $this;
80
	}
81
82
	public function setFinderEvents(FinderEventsInterface $finderEvents)
83
	{
84
		$this->finderEvents = $finderEvents;
85
		return $this;
86
	}
87
88
	public function setProfiler(ProfilerInterface $profiler)
89
	{
90
		$this->profiler = $profiler;
91
		return $this;
92
	}
93
94
}
95