TwigExtractor
extends AbstractFileExtractor
in package
implements
ExtractorInterface
TwigExtractor extracts translation messages from a twig template.
Tags
Table of Contents
Interfaces
- ExtractorInterface
- Extracts translation messages from a directory or files to the catalogue.
Properties
- $defaultDomain : string
- Default domain for found messages.
- $prefix : string
- Prefix for found message.
- $twig : mixed
Methods
- __construct() : mixed
- extract() : mixed
- Extracts translation messages from files, a file or a directory to the catalogue.
- setPrefix() : mixed
- Sets the prefix that should be used for new found messages.
- canBeExtracted() : bool
- extractFiles() : iterable<string|int, mixed>
- extractFromDirectory() : iterable<string|int, mixed>
- extractTemplate() : mixed
- isFile() : bool
- toSplFileInfo() : SplFileInfo
Properties
$defaultDomain
Default domain for found messages.
private
string
$defaultDomain
= 'messages'
$prefix
Prefix for found message.
private
string
$prefix
= ''
$twig
private
mixed
$twig
Methods
__construct()
public
__construct(Environment $twig) : mixed
Parameters
- $twig : Environment
extract()
Extracts translation messages from files, a file or a directory to the catalogue.
public
extract(mixed $resource, MessageCatalogue $catalogue) : mixed
Parameters
- $resource : mixed
-
Files, a file or a directory
- $catalogue : MessageCatalogue
setPrefix()
Sets the prefix that should be used for new found messages.
public
setPrefix(string $prefix) : mixed
Parameters
- $prefix : string
canBeExtracted()
protected
canBeExtracted(string $file) : bool
Parameters
- $file : string
Return values
boolextractFiles()
protected
extractFiles(string|iterable<string|int, mixed> $resource) : iterable<string|int, mixed>
Parameters
- $resource : string|iterable<string|int, mixed>
Return values
iterable<string|int, mixed>extractFromDirectory()
protected
extractFromDirectory(mixed $directory) : iterable<string|int, mixed>
Parameters
- $directory : mixed
Return values
iterable<string|int, mixed>extractTemplate()
protected
extractTemplate(string $template, MessageCatalogue $catalogue) : mixed
Parameters
- $template : string
- $catalogue : MessageCatalogue
isFile()
protected
isFile(string $file) : bool
Parameters
- $file : string
Tags
Return values
booltoSplFileInfo()
private
toSplFileInfo(string $file) : SplFileInfo
Parameters
- $file : string