Template::getIterator()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Patron package.
5
 *
6
 * (c) Olivier Laviale <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Patron;
13
14
class Template implements \IteratorAggregate
15
{
16
	/**
17
	 * @var string|null
18
	 */
19
	public $file;
20
21
	/**
22
	 * @var Node[]
23
	 */
24
	public $nodes;
25
26
	/**
27
	 * @param Node[] $nodes
28
	 * @param array $options
29
	 */
30
	public function __construct(array $nodes, array $options = [])
31
	{
32
		$this->nodes = $nodes;
33
34
		if (isset($options['file']))
35
		{
36
			$this->file = $options['file'];
37
		}
38
	}
39
40
	/**
41
	 * @return Node[]|\ArrayIterator
42
	 */
43
	public function getIterator()
44
	{
45
		return new \ArrayIterator($this->nodes);
46
	}
47
}
48