Documentation

ApkgReader
in package

FinalYes

Reads an .apkg file and yields ApkgNote objects.

Resolves field positions by name from the note type definition rather than hard-coded indexes, so .apkg files modified in Anki (where the user might reorder fields) still parse correctly. Unknown notes (no LWT id field, or a guid not in our prefix) are returned without an lwtTermId-assertable id — the caller decides what to do with them.

Table of Contents

Methods

read()  : array<int, ApkgNote>
buildFieldOrdMap()  : array<int, array<string, int>>
decodeTags()  : array<int, string>
loadSuspendedNotes()  : array<int, true>
readCollection()  : array<int, ApkgNote>

Methods

buildFieldOrdMap()

private buildFieldOrdMap(array<string|int, mixed> $models) : array<int, array<string, int>>
Parameters
$models : array<string|int, mixed>
Return values
array<int, array<string, int>>

decodeTags()

private decodeTags(string $raw) : array<int, string>
Parameters
$raw : string
Return values
array<int, string>

loadSuspendedNotes()

private loadSuspendedNotes(PDO $pdo) : array<int, true>
Parameters
$pdo : PDO
Return values
array<int, true>

readCollection()

private readCollection(string $dbPath) : array<int, ApkgNote>
Parameters
$dbPath : string
Return values
array<int, ApkgNote>
On this page

Search results