| Total Complexity | 5 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | abstract class AbstractMergeBase implements PhpMergeInterface |
||
| 26 | { |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Merge obvious cases when only one text changes.. |
||
| 30 | * |
||
| 31 | * @param string $base |
||
| 32 | * The original text. |
||
| 33 | * @param string $remote |
||
| 34 | * The first variant text. |
||
| 35 | * @param string $local |
||
| 36 | * The second variant text. |
||
| 37 | * |
||
| 38 | * @return string|null |
||
| 39 | * The merge result or null if the merge is not obvious. |
||
| 40 | */ |
||
| 41 | 21 | protected static function simpleMerge(string $base, string $remote, string $local) |
|
| 42 | { |
||
| 43 | // Skip complex merging if there is nothing to do. |
||
| 44 | 21 | if ($base === $remote) { |
|
| 45 | 4 | return $local; |
|
| 46 | } |
||
| 47 | 19 | if ($base === $local) { |
|
| 48 | 2 | return $remote; |
|
| 49 | } |
||
| 50 | 17 | if ($remote === $local) { |
|
| 51 | 2 | return $remote; |
|
| 52 | } |
||
| 53 | // Return nothing and let sub-classes deal with it. |
||
| 54 | 15 | return null; |
|
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Split it line-by-line. |
||
| 59 | * |
||
| 60 | * @param string $input |
||
| 61 | * |
||
| 62 | * @return array |
||
| 63 | */ |
||
| 64 | 12 | protected static function splitStringByLines(string $input): array |
|
| 67 | } |
||
| 68 | } |
||
| 69 |