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