Total Complexity | 4 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
19 | class ParseException extends HistoryAnalyserException |
||
20 | { |
||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | public const UNEXPECTED_END_OF_FILE = 'Unexpected end of file'; |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | private $location; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | private $reason; |
||
35 | |||
36 | /** |
||
37 | * Create from DiffParseException. |
||
38 | * |
||
39 | * @return ParseException |
||
40 | */ |
||
41 | public static function fromDiffParseException(string $location, DiffParseException $e): self |
||
42 | { |
||
43 | return new self($location, $e->getReason(), $e->getDetails(), $e); |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * ParseException constructor. |
||
48 | */ |
||
49 | public function __construct(string $location, string $reason, string $details, ?Throwable $previous) |
||
50 | { |
||
51 | $message = "Error parsing diff. Line {$location}. Reason: {$reason}. Details: [$details]"; |
||
52 | parent::__construct($message, 0, $previous); |
||
53 | $this->location = $location; |
||
54 | $this->reason = $reason; |
||
55 | } |
||
56 | |||
57 | public function getLocation(): string |
||
60 | } |
||
61 | |||
62 | public function getReason(): string |
||
67 |