| 1 | <?php |
||
| 18 | class ViewFactory |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * |
||
| 22 | * Returns a new View instance. |
||
| 23 | * |
||
| 24 | * @param object $helpers An arbitrary helper manager for the View; if not |
||
| 25 | * specified, uses the HelperRegistry from this package. |
||
| 26 | * |
||
| 27 | * @return View |
||
| 28 | * |
||
| 29 | */ |
||
| 30 | 9 | public function newInstance( |
|
| 31 | $helpers = null, |
||
| 32 | 9 | $view_map = [], |
|
| 33 | 9 | $view_paths = [], |
|
| 34 | 9 | $layout_map = [], |
|
| 35 | $layout_paths = [], |
||
| 36 | 9 | ) { |
|
|
|
|||
| 37 | 9 | if (! $helpers) { |
|
| 38 | 9 | $helpers = new HelperRegistry; |
|
| 39 | } |
||
| 40 | 9 | ||
| 41 | return new View( |
||
| 42 | new TemplateRegistry($view_map, $view_paths), |
||
| 43 | new TemplateRegistry($layout_map, $layout_paths), |
||
| 48 |