Completed
Pull Request — 2.x (#73)
by Hari
02:01
created

ViewFactory::newInstance()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
ccs 8
cts 8
cp 1
rs 9.4285
cc 2
eloc 7
nc 2
nop 1
crap 2
1
<?php
2
/**
3
 *
4
 * This file is part of Aura for PHP.
5
 *
6
 * @license http://opensource.org/licenses/bsd-license.php BSD
7
 *
8
 */
9
namespace Aura\View;
10
11
/**
12
 *
13
 * Factory to create View objects.
14
 *
15
 * @package Aura.View
16
 *
17
 */
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
    ) {
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected ')', expecting T_VARIABLE
Loading history...
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),
44
            $helpers
45
        );
46
    }
47
}
48