-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvectorscan.stub.php
More file actions
98 lines (79 loc) · 3.28 KB
/
vectorscan.stub.php
File metadata and controls
98 lines (79 loc) · 3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
/**
* @generate-class-entries
* @generate-function-entries
*/
namespace Vectorscan {
class Exception extends \Exception {}
class Database {
/**
* Compile one or more patterns into a database.
*
* @param array<string> $patterns Array of regex patterns
* @param array<int>|null $flags Array of flags per pattern
* @param array<int>|null $ids Array of integer IDs per pattern
* @param int $mode One of VECTORSCAN_MODE_BLOCK, VECTORSCAN_MODE_STREAM, VECTORSCAN_MODE_VECTORED
*/
public static function compile(
array $patterns,
?array $flags = null,
?array $ids = null,
int $mode = VECTORSCAN_MODE_BLOCK
): Database {}
/**
* Scan data against the compiled database.
*
* @param string $data The data to scan
* @param callable|null $callback Optional callback invoked per match: fn(array $match): bool
* @return array<array{id: int, from: int, to: int}> Array of matches
*/
public function scan(string $data, ?callable $callback = null): array {}
/** Serialize the database to a portable binary string. */
public function serialize(): string {}
/** Deserialize a database from a binary string. */
public static function unserialize(string $data): Database {}
/** Scan data and return true/false only (maximum speed, no match details). */
public function scanBool(string $data): bool {}
/** Get the size of the compiled database in bytes. */
public function size(): int {}
/** Get information about the compiled database. */
public function info(): string {}
}
class Scratch {
/** Create a scratch space for the given database. */
public function __construct(Database $database) {}
/** Get the size of the scratch space in bytes. */
public function size(): int {}
}
class Stream {
/**
* Open a new stream for streaming mode scanning.
*
* @param Database $database A database compiled with VECTORSCAN_MODE_STREAM
* @param callable $callback Callback invoked per match: fn(array $match): bool
*/
public static function open(Database $database, callable $callback): Stream {}
/** Scan a chunk of data in streaming mode. */
public function scan(string $data): void {}
/** Close the stream, flushing any remaining matches. */
public function close(): void {}
/** Reset the stream to its initial state. */
public function reset(): void {}
}
}
namespace {
/** Get the version string of the vectorscan library. */
function vectorscan_version(): string {}
/** Check if the current platform supports vectorscan. */
function vectorscan_valid_platform(): bool {}
/**
* Compile patterns and scan data in one call (convenience function).
*
* @param array<string> $patterns
* @param string $data
* @param array<int>|null $flags
* @param callable|null $callback
* @return array<array{id: int, from: int, to: int}>
*/
function vectorscan_scan(array $patterns, string $data, ?array $flags = null, ?callable $callback = null): array {}
}