Runner::run()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
1
<?php declare(strict_types=1);
2
3
/**
4
* @package   s9e\RegexpBuilder
5
* @copyright Copyright (c) 2016-2022 The s9e authors
6
* @license   http://www.opensource.org/licenses/mit-license.php The MIT License
7
*/
8
namespace s9e\RegexpBuilder;
9
10
use s9e\RegexpBuilder\Passes\PassInterface;
11
12
class Runner
13
{
14
	/**
15
	* @var PassInterface[]
16
	*/
17
	protected $passes = [];
18
19
	/**
20
	* Add a pass to the list
21
	*
22
	* @param  PassInterface $pass
23
	* @return void
24
	*/
25 1
	public function addPass(PassInterface $pass): void
26
	{
27 1
		$this->passes[] = $pass;
28 1
	}
29
30
	/**
31
	* Run all passes on the list of strings
32
	*
33
	* @param  array[] $strings
34
	* @return array[]
35
	*/
36 1
	public function run(array $strings): array
37
	{
38 1
		foreach ($this->passes as $pass)
39
		{
40 1
			$strings = $pass->run($strings);
41
		}
42
43 1
		return $strings;
44
	}
45
}