| Total Complexity | 7 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | final class FindChangeHunkStartState implements State |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * FindChangeHunkStartState constructor. |
||
| 24 | */ |
||
| 25 | public function __construct( |
||
| 26 | private FileMutationBuilder $fileMutationBuilder, |
||
| 27 | ) { |
||
| 28 | } |
||
| 29 | |||
| 30 | public function processLine(string $line): State |
||
| 31 | { |
||
| 32 | if (LineTypeDetector::isStartOfFileDiff($line)) { |
||
| 33 | return $this->processDiffStart(); |
||
| 34 | } |
||
| 35 | |||
| 36 | if (LineTypeDetector::isStartOfChangeHunk($line)) { |
||
| 37 | return $this->processChangeHunkStart($line); |
||
| 38 | } |
||
| 39 | |||
| 40 | return $this; |
||
| 41 | } |
||
| 42 | |||
| 43 | private function processDiffStart(): State |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @throws DiffParseException |
||
| 52 | */ |
||
| 53 | private function processChangeHunkStart(string $line): State |
||
| 54 | { |
||
| 55 | return new ChangeHunkParserState($this->fileMutationBuilder, $line); |
||
| 56 | } |
||
| 57 | |||
| 58 | public function finish(): void |
||
| 61 | } |
||
| 62 | } |
||
| 63 |