| @@ 56-70 (lines=15) @@ | ||
| 53 | * |
|
| 54 | * @return array |
|
| 55 | */ |
|
| 56 | public function parseError($message) |
|
| 57 | { |
|
| 58 | $pattern = '/^(PHP\s+)?(Parse|Fatal) error:\s*(?:\w+ error,\s*)?(?<error>.+?)\s+in\s+.+?\s*line\s+(?<line>\d+)/'; |
|
| 59 | ||
| 60 | $matched = preg_match($pattern, $message, $match); |
|
| 61 | ||
| 62 | if (empty($message)) { |
|
| 63 | $message = 'Unknown'; |
|
| 64 | } |
|
| 65 | ||
| 66 | return [ |
|
| 67 | 'error' => $matched ? "{$match['error']} in line {$match['line']}" : $message, |
|
| 68 | 'line' => $matched ? abs($match['line']) : 0, |
|
| 69 | ]; |
|
| 70 | } |
|
| 71 | ||
| 72 | /** |
|
| 73 | * @return bool |
|
| @@ 108-122 (lines=15) @@ | ||
| 105 | * |
|
| 106 | * @return array |
|
| 107 | */ |
|
| 108 | private function parseIssue($message) |
|
| 109 | { |
|
| 110 | $pattern = '/^(PHP\s+)?(Warning|Deprecated|Notice):\s*?(?<error>.+?)\s+in\s+.+?\s*line\s+(?<line>\d+)/'; |
|
| 111 | ||
| 112 | $matched = preg_match($pattern, $message, $match); |
|
| 113 | ||
| 114 | if (empty($message)) { |
|
| 115 | $message = 'Unknown'; |
|
| 116 | } |
|
| 117 | ||
| 118 | return [ |
|
| 119 | 'error' => $matched ? "{$match['error']} in line {$match['line']}" : $message, |
|
| 120 | 'line' => $matched ? abs($match['line']) : 0, |
|
| 121 | ]; |
|
| 122 | } |
|
| 123 | } |
|
| 124 | ||