ApkgWriter
in package
FinalYes
Builds a .apkg file (zip containing a schema-11 SQLite collection) from LWT term data.
Status mapping for cards.queue:
- LWT 1..5: queue=0 (new), due=position
- LWT 98: queue=-1 (suspended) — "ignored"
- LWT 99: queue=-1 (suspended) — "well-known"
SRS scheduling state (interval, ease, due-date for review cards) is intentionally not exported in this version; see Lemmatization-style follow-up.
Table of Contents
Constants
- COLLECTION_CREATION_TIMESTAMP : mixed = 1577836800
- Anki's special "ignored" deck id; we use one deck per language instead.
Methods
- write() : void
- buildCollection() : void
- encodeTags() : string
- Anki tag format: " tag1 tag2 " (leading + trailing space, single-space separated, empty string when no tags).
- jsonEncode() : string
- packageZip() : void
Constants
COLLECTION_CREATION_TIMESTAMP
Anki's special "ignored" deck id; we use one deck per language instead.
private
mixed
COLLECTION_CREATION_TIMESTAMP
= 1577836800
Methods
write()
public
write(string $outputPath, ApkgDeck $deck, array<int, ApkgNote> $notes) : void
Parameters
buildCollection()
private
buildCollection(string $dbPath, ApkgDeck $deck, array<int, ApkgNote> $notes) : void
Parameters
encodeTags()
Anki tag format: " tag1 tag2 " (leading + trailing space, single-space separated, empty string when no tags).
private
encodeTags(array<int, string> $tags) : string
Parameters
- $tags : array<int, string>
Return values
stringjsonEncode()
private
jsonEncode(array<string|int, mixed>|object $data) : string
Parameters
- $data : array<string|int, mixed>|object
Return values
stringpackageZip()
private
packageZip(string $outputPath, string $collectionDbPath) : void
Parameters
- $outputPath : string
- $collectionDbPath : string