TwigExtractor
extends AbstractFileExtractor
in package
implements
ExtractorInterface
TwigExtractor extracts translation messages from a twig template.
Tags
Interfaces, Classes, Traits and Enums
- ExtractorInterface
- Extracts translation messages from a directory or files to the catalogue.
Table of Contents
- $defaultDomain : string
- Default domain for found messages.
- $prefix : string
- Prefix for found message.
- $twig : mixed
- __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() : iteratable<string|int, mixed>
- extractFromDirectory() : iteratable<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
Return values
mixed —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
Return values
mixed —setPrefix()
Sets the prefix that should be used for new found messages.
public
setPrefix(mixed $prefix) : mixed
Parameters
- $prefix : mixed
-
The prefix
Return values
mixed —canBeExtracted()
protected
canBeExtracted(string $file) : bool
Parameters
- $file : string
Return values
bool —extractFiles()
protected
extractFiles(string|iteratable<string|int, mixed> $resource) : iteratable<string|int, mixed>
Parameters
- $resource : string|iteratable<string|int, mixed>
-
Files, a file or a directory
Return values
iteratable<string|int, mixed> —extractFromDirectory()
protected
extractFromDirectory(mixed $directory) : iteratable<string|int, mixed>
Parameters
- $directory : mixed
Return values
iteratable<string|int, mixed> —files to be extracted
extractTemplate()
protected
extractTemplate(mixed $template, MessageCatalogue $catalogue) : mixed
Parameters
- $template : mixed
- $catalogue : MessageCatalogue
Return values
mixed —isFile()
protected
isFile(string $file) : bool
Parameters
- $file : string
Tags
Return values
bool —toSplFileInfo()
private
toSplFileInfo(string $file) : SplFileInfo
Parameters
- $file : string