1 | <?php |
||
9 | class DefaultViewFinder implements ViewFinder |
||
10 | { |
||
11 | /** |
||
12 | * @var string|null base namespace for view-models supported by this finder |
||
13 | */ |
||
14 | public $namespace; |
||
15 | |||
16 | /** |
||
17 | * @var MultiViewFinder |
||
18 | */ |
||
19 | private $finders; |
||
20 | |||
21 | /** |
||
22 | * @param string[] $root_paths list of absolute paths to possible view root-folders (in order by priority) |
||
23 | * @param string|null $namespace optional; base namespace for view-models supported by this finder |
||
24 | */ |
||
25 | 1 | public function __construct(array $root_paths, $namespace = null) |
|
26 | { |
||
27 | 1 | $this->namespace = $namespace; |
|
28 | |||
29 | 1 | $this->finders = new MultiViewFinder(); |
|
30 | |||
31 | 1 | foreach ($root_paths as $root_path) { |
|
32 | 1 | $this->finders->addViewFinder(new SimpleViewFinder($root_path, $namespace)); |
|
33 | } |
||
34 | 1 | } |
|
35 | |||
36 | /** |
||
37 | * @inheritdoc |
||
38 | */ |
||
39 | 1 | public function findTemplate($view_model, $type) |
|
43 | |||
44 | /** |
||
45 | * @inheritdoc |
||
46 | */ |
||
47 | 1 | public function listSearchPaths($view_model, $type) |
|
51 | } |
||
52 |