Completed
Push — master ( bd60ab...c7f462 )
by T
02:13
created

Result::output()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4286
cc 2
eloc 4
nc 2
nop 1
crap 2
1
<?php
2
3
namespace tomzx\Dataflow;
4
5
class Result {
6
	/**
7
	 * @var array
8
	 */
9
	private $nodes = [];
10
11 6
	public function __construct(array $nodes)
12
	{
13 6
		$this->nodes = $nodes;
14 6
	}
15
16
	/**
17
	 * @param int|string $nodeIndex
18
	 * @return null
19
	 */
20 6
	public function output($nodeIndex)
21
	{
22 6
		if ( ! array_key_exists($nodeIndex, $this->nodes)) {
23 1
			return null;
24
		}
25
26 5
		return $this->nodes[$nodeIndex]->output();
27
	}
28
}
29