more php version check
This commit is contained in:
		| @@ -2,6 +2,7 @@ | ||||
|  | ||||
| namespace App\Utilities; | ||||
|  | ||||
| use Exception; | ||||
| use Illuminate\Console\Application; | ||||
| use Illuminate\Support\Str; | ||||
| use Symfony\Component\Process\Exception\InvalidArgumentException; | ||||
| @@ -9,6 +10,7 @@ use Symfony\Component\Process\Exception\LogicException; | ||||
| use Symfony\Component\Process\Exception\ProcessFailedException; | ||||
| use Symfony\Component\Process\Exception\RuntimeException; | ||||
| use Symfony\Component\Process\Process; | ||||
| use Throwable; | ||||
|  | ||||
| class Console | ||||
| { | ||||
| @@ -29,12 +31,21 @@ class Console | ||||
|             if (static::isValidOutput($output)) { | ||||
|                 return true; | ||||
|             } | ||||
|         } catch (InvalidArgumentException | LogicException | ProcessFailedException | RuntimeException $e) { | ||||
|         } catch (Exception | InvalidArgumentException | LogicException | ProcessFailedException | RuntimeException | Throwable $e) { | ||||
|             $output = $e->getMessage(); | ||||
|         } | ||||
|  | ||||
|         logger('Console output:: ' . $output); | ||||
|  | ||||
|         return static::formatOutput($output); | ||||
|     } | ||||
|  | ||||
|     public static function formatOutput($output) | ||||
|     { | ||||
|         $output = nl2br($output); | ||||
|         $output = str_replace(['"', "'"], '', $output); | ||||
|         $output = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $output); | ||||
|  | ||||
|         return $output; | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user