| 1 | <?php |
||
| 19 | class Line |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * Possible line operations |
||
| 23 | */ |
||
| 24 | const ADDED = 'added'; |
||
| 25 | const REMOVED = 'removed'; |
||
| 26 | const EXISTED = 'existed'; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Map diff output to file operation |
||
| 30 | * @var array |
||
| 31 | */ |
||
| 32 | public static $opsMap = [ |
||
| 33 | '+' => self::ADDED, |
||
| 34 | '-' => self::REMOVED, |
||
| 35 | ' ' => self::EXISTED |
||
| 36 | ]; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @var string |
||
| 40 | */ |
||
| 41 | private $operation; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @var string |
||
| 45 | */ |
||
| 46 | private $content; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Line constructor. |
||
| 50 | * |
||
| 51 | * @param string $operation |
||
| 52 | * @param string $content |
||
| 53 | */ |
||
| 54 | 11 | public function __construct(string $operation, string $content) |
|
| 62 | |||
| 63 | /** |
||
| 64 | * Operation getter. |
||
| 65 | * |
||
| 66 | * @return string |
||
| 67 | */ |
||
| 68 | 4 | public function getOperation(): string |
|
| 72 | |||
| 73 | /** |
||
| 74 | * Content getter. |
||
| 75 | * |
||
| 76 | * @return string |
||
| 77 | */ |
||
| 78 | 2 | public function getContent(): string |
|
| 82 | } |
||
| 83 |