PublicLabelTreeImport
class PublicLabelTreeImport extends Import
Properties
protected string | $path | Path to the directory with the import files. |
from Import |
protected Collection | $importLabelTree | Caches the decoded label tree import file. |
Methods
The files expected by this import.
Validate a file of this import.
Validates a JSON file to contain an array of objects, each of which has all the expected keys.
Validates a CSV file to contain the expected columns.
Read a JSON file containing an array and wrap it in a Laravel collection.
Perform the import.
Checks if the label tree of the import already exists.
Get the contents of the label tree import file.
Details
in
Import at line 23
__construct(string $path)
Create a new instance.
in
Import at line 33
bool
filesMatch()
Check if this import matches to the given import files.
in
Import at line 48
validateFiles()
Check if the files of this import are valid.
at line 70
protected array
expectedFiles()
The files expected by this import.
in
Import at line 70
protected array
files()
Get the basename of each file of this import.
at line 81
protected
validateFile(string $basename)
Validate a file of this import.
in
Import at line 98
protected
expectKeysInJson(string $file, array $expectation, bool $array = true)
Validates a JSON file to contain an array of objects, each of which has all the expected keys.
in
Import at line 124
protected
expectColumnsInCsv(string $file, array $expectation)
Validates a CSV file to contain the expected columns.
in
Import at line 148
protected Collection
collectJson(string $file)
Read a JSON file containing an array and wrap it in a Laravel collection.
at line 25
perform()
Perform the import.
at line 46
bool
treeExists()
Checks if the label tree of the import already exists.
at line 58
protected Collection
getImportLabelTree()
Get the contents of the label tree import file.
at line 110
protected
importLabels(LabelTree $tree)
Import the labels of this import.