Result::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
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