1 | <?php |
||
20 | class JsonDumpFactory { |
||
21 | |||
22 | /** |
||
23 | * Creates a DumpReader that can read lines from a bz2 compressed JSON dump. |
||
24 | * @since 1.1.0 |
||
25 | * |
||
26 | * @param string $dumpFilePath |
||
27 | * @param int $initialPosition since 1.3.0 |
||
28 | * |
||
29 | * @return SeekableDumpReader |
||
30 | */ |
||
31 | 3 | public function newGzDumpReader( $dumpFilePath, $initialPosition = 0 ) { |
|
34 | |||
35 | /** |
||
36 | * Creates a DumpReader that can read lines from an uncompressed JSON dump. |
||
37 | * @since 1.0.0 |
||
38 | * |
||
39 | * @param string $dumpFilePath |
||
40 | * @param int $initialPosition |
||
41 | * |
||
42 | * @return SeekableDumpReader |
||
43 | */ |
||
44 | 1 | public function newExtractedDumpReader( $dumpFilePath, $initialPosition = 0 ) { |
|
47 | |||
48 | /** |
||
49 | * Creates a DumpReader that can read lines from a bz2 compressed JSON dump. |
||
50 | * @since 1.0.0 |
||
51 | * |
||
52 | * @param string $dumpFilePath |
||
53 | * |
||
54 | * @return DumpReader |
||
55 | */ |
||
56 | 2 | public function newBz2DumpReader( $dumpFilePath ) { |
|
59 | |||
60 | /** |
||
61 | * Creates an Iterator over each JSON serialized Entity in the dump. |
||
62 | * @since 1.0.0 |
||
63 | * |
||
64 | * @param DumpReader $dumpReader |
||
65 | * @param callable $onError Gets called with a single string parameter on error |
||
66 | * |
||
67 | * @return Iterator string[] |
||
68 | */ |
||
69 | 16 | public function newStringDumpIterator( DumpReader $dumpReader, callable $onError = null ) { |
|
95 | |||
96 | /** |
||
97 | * Creates an Iterator over each Entity in the dump as PHP array/object in the JSON format. |
||
98 | * This is essentially a json_decode map of the string dump iterator. |
||
99 | * @since 1.0.0 |
||
100 | * |
||
101 | * @param DumpReader $dumpReader |
||
102 | * @param callable $onError Gets called with a single string parameter on error |
||
103 | * |
||
104 | * @return Iterator array[] |
||
105 | */ |
||
106 | 14 | public function newObjectDumpIterator( DumpReader $dumpReader, callable $onError = null ) { |
|
115 | |||
116 | /** |
||
117 | * Creates an Iterator over each Entity in the dump, fully deserialized as EntityDocument. |
||
118 | * @since 1.0.0 |
||
119 | * |
||
120 | * @param DumpReader $dumpReader |
||
121 | * @param Deserializer $entityDeserializer |
||
122 | * @param callable $onError Gets called with a single string parameter on error |
||
123 | * |
||
124 | * @return Iterator EntityDocument[] |
||
125 | */ |
||
126 | 8 | public function newEntityDumpIterator( DumpReader $dumpReader, Deserializer $entityDeserializer, callable $onError = null ) { |
|
136 | |||
137 | } |