You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

45 lines
766 B

<?php declare(strict_types=1);
/**
* @package s9e\RegexpBuilder
* @copyright Copyright (c) The s9e authors
* @license https://opensource.org/licenses/mit-license.php The MIT License
*/
namespace s9e\RegexpBuilder;
use s9e\RegexpBuilder\Passes\PassInterface;
class Runner
{
/**
* @var PassInterface[]
*/
protected array $passes = [];
/**
* Add a pass to the list
*
* @param PassInterface $pass
* @return void
*/
public function addPass(PassInterface $pass): void
{
$this->passes[] = $pass;
}
/**
* Run all passes on the list of strings
*
* @param array[] $strings
* @return array[]
*/
public function run(array $strings): array
{
foreach ($this->passes as $pass)
{
$strings = $pass->run($strings);
}
return $strings;
}
}