final class TableFile
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.

Stores parse tables as deflated files and loads them once per process.

Methods§

public function __construct(private TableCodec $codec = new \SqlParser\Table\TableCodec())

Parameters

$codecTableCodecConverts between tables and bytes
Calls 1
public function save(ParseTable $table, string $path): void

Writes a table to a file.

Parameters

$tableParseTableTable to store
$pathstringWhere to write it

Throws

RuntimeException When the file cannot be written
Test cases 2
Called from 1
Calls 4
public function load(string $path): ParseTable

Reads a table from a file, reusing it when the same file was read before.

Parameters

$pathstringFile written by save()

Returns

ParseTable The table

Throws

RuntimeException When the file is missing, not deflated, or not an encoded table
Test cases 5
Called from 3
Calls 5
public function inflate(string $compressed): string|null

Inflates deflated bytes, quietly answering null when they are not deflated.

Parameters

$compressedstringBytes read from the file

Returns

string|null The inflated bytes, or null when inflating fails
Test cases 1
Called from 1
Calls 3
  • function-call set_error_handler line 79
  • function-call gzinflate line 81
  • function-call restore_error_handler line 83
public static function forget(): void

Forgets every table loaded so far, so a rewritten file is read again.

Test cases 2

Private surface 2§

Implementation details, listed for orientation only.

private static array<string, ParseTable> $loaded = []
private TableCodec $codec = new \SqlParser\Table\TableCodec()

Test cases 10§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 5
Other tests reaching this symbol 5

Relations§

Instantiated in 4
Method calls 4
Type declarations 1