Skip to content

Commit 89004be

Browse files
committed
refactor: Various improvements
1 parent d53ddb6 commit 89004be

11 files changed

Lines changed: 1420 additions & 822 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Cortex\JsonRepair\Exceptions;
6+
7+
use RuntimeException;
8+
9+
class JsonRepairException extends RuntimeException
10+
{
11+
/**
12+
* Create a new exception for invalid JSON after repair.
13+
*
14+
* This exception is thrown when the repair process completes but the
15+
* resulting output is still not valid JSON.
16+
*
17+
* @param string $json The repaired JSON that is still invalid
18+
*
19+
* @return self A new JsonRepairException instance
20+
*/
21+
public static function invalidJsonAfterRepair(string $json): self
22+
{
23+
return new self(
24+
sprintf(
25+
'JSON repair completed but the result is still invalid JSON: %s',
26+
$json,
27+
),
28+
);
29+
}
30+
}

0 commit comments

Comments
 (0)