ImporterInterface
in
Interface for dictionary importers.
Defines the contract for parsing dictionary files and yielding entries.
Tags
Table of Contents
Methods
- canImport() : bool
- Validate that a file can be imported.
- getSupportedExtensions() : array<string|int, string>
- Get the supported file extensions for this importer.
- parse() : iterable<string|int, array{term: string, definition: string, reading?: ?string, pos?: ?string}>
- Parse a dictionary file and yield entries.
- preview() : array<string|int, array{term: string, definition: string, reading?: ?string, pos?: ?string}>
- Get a preview of the first N entries.
Methods
canImport()
Validate that a file can be imported.
public
canImport(string $filePath) : bool
Parameters
- $filePath : string
-
Path to the file
Return values
bool —True if the file can be imported
getSupportedExtensions()
Get the supported file extensions for this importer.
public
getSupportedExtensions() : array<string|int, string>
Return values
array<string|int, string>parse()
Parse a dictionary file and yield entries.
public
parse(string $filePath[, array<string, mixed> $options = [] ]) : iterable<string|int, array{term: string, definition: string, reading?: ?string, pos?: ?string}>
Parameters
- $filePath : string
-
Path to the dictionary file
- $options : array<string, mixed> = []
-
Import options (format-specific)
Return values
iterable<string|int, array{term: string, definition: string, reading?: ?string, pos?: ?string}>preview()
Get a preview of the first N entries.
public
preview(string $filePath[, int $limit = 10 ][, array<string, mixed> $options = [] ]) : array<string|int, array{term: string, definition: string, reading?: ?string, pos?: ?string}>
Parameters
- $filePath : string
-
Path to the dictionary file
- $limit : int = 10
-
Number of entries to preview
- $options : array<string, mixed> = []
-
Import options