| Total Complexity | 3 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 6 | class ProcessFactory |
||
| 7 | { |
||
| 8 | /** |
||
| 9 | * @param string $rangeName |
||
| 10 | * @param bool $isReprocess |
||
| 11 | * @return ProcessInterface |
||
| 12 | */ |
||
| 13 | 4 | public function createFromKey(string $rangeName, bool $isReprocess = false): ProcessInterface |
|
| 14 | { |
||
| 15 | 4 | list($firstNumber, $lastNumber) = $this->extractNumbers($rangeName); |
|
| 16 | |||
| 17 | 4 | return new Process($firstNumber, $lastNumber, $isReprocess); |
|
| 18 | } |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @param $rangeNameWithoutPrefix |
||
| 22 | * @return array |
||
| 23 | */ |
||
| 24 | 4 | private function extractNumbers($rangeNameWithoutPrefix): array |
|
| 25 | { |
||
| 26 | 4 | return explode('_', $rangeNameWithoutPrefix); |
|
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @param ProcessInterface $process |
||
| 31 | * @return string |
||
| 32 | */ |
||
| 33 | 3 | public function getProcessKey(ProcessInterface $process): string |
|
| 36 | } |
||
| 37 | } |
||
| 38 |