Completed
Push — master ( ef6746...5a635f )
by Ron
07:26
created

FileWorkerConfiguration::getPaths()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
namespace View\Workers\FileWorker;
3
4
use View\Contexts\Context;
5
use View\Contexts\HtmlContext;
6
use View\Helpers\RecursiveStringPath;
7
use View\Proxying\ObjectProxyFactory;
8
use View\Workers\WorkerConfiguration;
9
10
class FileWorkerConfiguration implements WorkerConfiguration {
11
	/** @var Context */
12
	private $context;
13
	/** @var RecursiveStringPath */
14
	private $recursiveAccessor;
15
	/** @var ObjectProxyFactory */
16
	private $objectProxyFactory;
17
	/** @var array */
18
	private $config;
19
	
20
	/**
21
	 * @param Context $context
22
	 * @param RecursiveStringPath $recursiveAccessor
23
	 * @param ObjectProxyFactory $objectProxyFactory
24
	 * @param array $config
25
	 */
26
	public function __construct(Context $context = null, RecursiveStringPath $recursiveAccessor = null, ObjectProxyFactory $objectProxyFactory = null, array $config = []) {
27
		if($context === null) {
28
			$context = new HtmlContext();
29
		}
30
		if($recursiveAccessor === null) {
31
			$recursiveAccessor = new RecursiveStringPath();
32
		}
33
		if($objectProxyFactory === null) {
34
			$objectProxyFactory = new ObjectProxyFactory($context);
35
		}
36
		$this->context = $context;
37
		$this->recursiveAccessor = $recursiveAccessor;
38
		$this->objectProxyFactory = $objectProxyFactory;
39
		$this->config = $config;
40
	}
41
42
	/**
43
	 * @return Context
44
	 */
45
	public function getContext() {
46
		return $this->context;
47
	}
48
49
	/**
50
	 * @return RecursiveStringPath
51
	 */
52
	public function getRecursiveAccessor() {
53
		return $this->recursiveAccessor;
54
	}
55
56
	/**
57
	 * @return ObjectProxyFactory
58
	 */
59
	public function getObjectProxyFactory() {
60
		return $this->objectProxyFactory;
61
	}
62
	
63
	/**
64
	 * @return array
65
	 */
66
	public function getPaths() {
67
		if(array_key_exists('paths', $this->config)) {
68
			return $this->config['paths'];
69
		}
70
		return [];
71
	}
72
}
73