more php version check

This commit is contained in:
Denis Duliçi
2020-08-24 17:45:29 +03:00
parent e6f2075eef
commit 13a0113e8e
3 changed files with 29 additions and 2 deletions

View File

@ -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;
}