Clean up unused code in ValidationException

This commit is contained in:
Alex Cabal 2023-07-06 21:48:28 -05:00
parent d83c67839f
commit fda3ca6695

View file

@ -1,26 +1,19 @@
<? <?
namespace Exceptions; namespace Exceptions;
use function Safe\json_encode;
class ValidationException extends SeException{ class ValidationException extends SeException{
public $Exceptions = []; public $Exceptions = [];
public $HasExceptions = false; public $HasExceptions = false;
public $IsFatal = false; public $IsFatal = false;
public function __construct(?\Exception $exception = null){
if($exception !== null){
$this->Add($exception);
}
}
public function __toString(): string{ public function __toString(): string{
$output = ''; $output = '';
foreach($this->Exceptions as $exception){ foreach($this->Exceptions as $exception){
$output .= $exception->getMessage() . '; '; $output .= $exception->getMessage() . "\n";
} }
return rtrim($output, '; '); return rtrim($output);
} }
public function Add(\Exception $exception, bool $isFatal = false): void{ public function Add(\Exception $exception, bool $isFatal = false): void{
@ -40,17 +33,6 @@ class ValidationException extends SeException{
$this->HasExceptions = true; $this->HasExceptions = true;
} }
public function Serialize(): string{
$val = '';
foreach($this->Exceptions as $childException){
$val .= $childException->getCode() . ',';
}
$val = rtrim($val, ',');
return $val;
}
public function Has(string $exception): bool{ public function Has(string $exception): bool{
foreach($this->Exceptions as $childException){ foreach($this->Exceptions as $childException){
if(is_a($childException, $exception)){ if(is_a($childException, $exception)){