| Total Complexity | 4 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | class FindRenameToState implements State |
||
| 22 | { |
||
| 23 | const RENAME_TO = 'rename to '; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var FileMutationBuilder |
||
| 27 | */ |
||
| 28 | private $fileMutationBuilder; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * FindRenameToState constructor. |
||
| 32 | */ |
||
| 33 | public function __construct(FileMutationBuilder $fileMutationBuilder) |
||
| 34 | { |
||
| 35 | $this->fileMutationBuilder = $fileMutationBuilder; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function processLine(string $line): State |
||
| 39 | { |
||
| 40 | if (!StringUtils::startsWith(self::RENAME_TO, $line)) { |
||
| 41 | throw DiffParseException::missingRenameTo($line); |
||
| 42 | } |
||
| 43 | |||
| 44 | $newFileName = StringUtils::removeFromStart(self::RENAME_TO, $line); |
||
| 45 | $this->fileMutationBuilder->setNewFileName(new NewFileName($newFileName)); |
||
| 46 | |||
| 47 | return new FindChangeHunkStartState($this->fileMutationBuilder); |
||
| 48 | } |
||
| 49 | |||
| 50 | public function finish(): void |
||
| 53 | } |
||
| 54 | } |
||
| 55 |