PlainTextExtractor

class \TYPO3\CMS\Core\Resource\TextExtraction\PlainTextExtractor

Implements
TextExtractorInterface, StructuredTextExtractorInterface

A simple text extractor to extract text from plain text files.

Attributes

#[AsTextExtractor]

Table of Contents

Interfaces

TextExtractorInterface
Interface for text extractors, which are registered as tagged services via the #[AsTextExtractor] attribute or the 'fal.text_extractor' service tag.
StructuredTextExtractorInterface
A text extractor that is bound to MIME types and returns, next to the text, the metadata it found in the resource, such as a title or keywords.

Methods

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.
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.

Methods

canExtractText()

Checks if the given file can be read by this extractor

public canExtractText(FileInterface $file) : bool

Parameters

$file : FileInterface

Return values

bool

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>
On this page