Rename codes

This commit is contained in:
Andrea Marco Sartori 2022-12-03 20:41:54 +10:00
parent b92193cda9
commit ed1def1572
3 changed files with 8 additions and 8 deletions

View File

@ -10,9 +10,9 @@ use Exception;
*/
abstract class JsonParserException extends Exception
{
public const CODE_SOURCE_INVALID = 0;
public const CODE_SOURCE_UNSUPPORTED = 1;
public const CODE_SOURCE_GUZZLE = 2;
public const SOURCE_INVALID = 0;
public const SOURCE_UNSUPPORTED = 1;
public const SOURCE_GUZZLE = 2;
public const CODE_POINTER_INVALID = 3;
public const POINTER_INVALID = 0;
}

View File

@ -16,6 +16,6 @@ class PointerException extends JsonParserException
*/
public static function invalid(string $pointer): static
{
return new static("The string [$pointer] is not a valid JSON pointer", static::CODE_POINTER_INVALID);
return new static("The string [$pointer] is not a valid JSON pointer", static::POINTER_INVALID);
}
}

View File

@ -16,7 +16,7 @@ class SourceException extends JsonParserException
*/
public static function invalid(string $source): static
{
return new static("[$source] is not a valid source", static::CODE_SOURCE_INVALID);
return new static("[$source] is not a valid source", static::SOURCE_INVALID);
}
/**
@ -26,7 +26,7 @@ class SourceException extends JsonParserException
*/
public static function unsupported(): static
{
return new static('Unable to load JSON from the provided source', static::CODE_SOURCE_UNSUPPORTED);
return new static('Unable to load JSON from the provided source', static::SOURCE_UNSUPPORTED);
}
/**
@ -36,6 +36,6 @@ class SourceException extends JsonParserException
*/
public static function requireGuzzle(): static
{
return new static('Guzzle is required to load JSON from endpoints', static::CODE_SOURCE_GUZZLE);
return new static('Guzzle is required to load JSON from endpoints', static::SOURCE_GUZZLE);
}
}