CsvTextExtractor

final class \TYPO3\CMS\IndexedSearch\TextExtraction\CsvTextExtractor

Extends
AbstractTextExtractor

Extracts the raw text of CSV files, which are assumed to be UTF-8 encoded.

Attributes

#[AsTextExtractor]

Table of Contents

Properties

$commandExecutor  : ExternalCommandExecutor
$toolConfiguration  : ExternalToolConfiguration

Methods

__construct()  : mixed
canExtractText()  : bool
Checks if the given file can be read by this extractor
extractStructuredText()  : ExtractedText
The actual text extraction, returning the text and the metadata of the resource
extractText()  : string
The actual text extraction, returning a string of the file's content
getSupportedMimeTypes()  : array<int, string>
Lowercase MIME types which this extractor can currently handle. Generic detections, such as "application/zip" for a Word document, are resolved to the concrete MIME type by the file extension via $GLOBALS['TYPO3_CONF_VARS']['SYS']['FileInfo']['mimeTypeCompatibility'], so an extractor does not need to declare them.
removeEndJunk()  : string
Removes some strange char(12) characters and line breaks that tend to occur at the end of external tool output.
checkRequiredTools()  : bool
extractFromLocalFile()  : ExtractedText
getMimeTypes()  : array<int, string>
getMissingTools()  : array<int, string>
getRequiredTools()  : array<int, "pdfinfo"|"pdftotext"|"catdoc"|"ppthtml"|"xlhtml"|"unzip"|"unrtf">
getToolPath()  : string
joinOutput()  : string
stripXmlTags()  : string
withLocalFile()  : T
Provides a local copy of the file to the callback, and cleans up afterwards.

Properties

Methods

canExtractText()

Checks if the given file can be read by this extractor

public canExtractText(FileInterface $file) : bool

Parameters

$file : FileInterface

Return values

bool

extractText()

The actual text extraction, returning a string of the file's content

public extractText(FileInterface $file) : string

Parameters

$file : FileInterface

Return values

string

getSupportedMimeTypes()

Lowercase MIME types which this extractor can currently handle. Generic detections, such as "application/zip" for a Word document, are resolved to the concrete MIME type by the file extension via $GLOBALS['TYPO3_CONF_VARS']['SYS']['FileInfo']['mimeTypeCompatibility'], so an extractor does not need to declare them.

public getSupportedMimeTypes() : array<int, string>

Return values

array<int, string>

removeEndJunk()

Removes some strange char(12) characters and line breaks that tend to occur at the end of external tool output.

public static removeEndJunk(string $string) : string

Parameters

$string : string

Return values

string

getMimeTypes()

protected getMimeTypes() : array<int, string>

Return values

array<int, string>

getMissingTools()

protected getMissingTools() : array<int, string>

Return values

array<int, string>

getRequiredTools()

protected getRequiredTools() : array<int, "pdfinfo"|"pdftotext"|"catdoc"|"ppthtml"|"xlhtml"|"unzip"|"unrtf">

Return values

array<int, "pdfinfo"|"pdftotext"|"catdoc"|"ppthtml"|"xlhtml"|"unzip"|"unrtf">

getToolPath()

protected getToolPath(string $tool) : string

Parameters

$tool : string

Return values

string

joinOutput()

protected joinOutput(array<int, string> $output) : string

Parameters

$output : array<int, string>

Return values

string

stripXmlTags()

protected stripXmlTags(string $xml) : string

Parameters

$xml : string

Return values

string

withLocalFile()

Provides a local copy of the file to the callback, and cleans up afterwards.

protected withLocalFile(SystemResourceInterface $file, callable(string): T $callback) : T

Parameters

$file : SystemResourceInterface
$callback : callable(string): T

Tags

template

Return values

T
On this page