Result::output()   A
last analyzed

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
	/**
12
	 * @param array $nodes
13
	 */
14 7
	public function __construct(array $nodes)
15
	{
16 7
		$this->nodes = $nodes;
17 7
	}
18
19
	/**
20
	 * @param int|string $nodeIndex
21
	 * @return mixed|null
22
	 */
23 7
	public function output($nodeIndex)
24
	{
25 7
		if ( ! array_key_exists($nodeIndex, $this->nodes)) {
26 1
			return null;
27
		}
28
29 6
		return $this->nodes[$nodeIndex]->output();
30
	}
31
}
32