class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface

PhpExtractor extracts translation messages from a PHP template.

Constants

MESSAGE_TOKEN

METHOD_ARGUMENTS_TOKEN

DOMAIN_TOKEN

Properties

protected array $sequences The sequence that captures translation messages.

Methods

array
extractFiles(string|array $resource)

No description

bool
isFile(string $file)

No description

bool
canBeExtracted(string $file)

No description

array
extractFromDirectory(string|array $directory)

No description

extract(string|array $resource, MessageCatalogue $catalog)

Extracts translation messages from files, a file or a directory to the catalogue.

setPrefix(string $prefix)

Sets the prefix that should be used for new found messages.

string
normalizeToken(mixed $token)

Normalizes a token.

parseTokens(array $tokens, MessageCatalogue $catalog)

Extracts trans message from PHP tokens.

Details

in AbstractFileExtractor at line 28
protected array extractFiles(string|array $resource)

Parameters

string|array $resource Files, a file or a directory

Return Value

array

in AbstractFileExtractor at line 58
protected bool isFile(string $file)

Parameters

string $file

Return Value

bool

Exceptions

InvalidArgumentException

at line 250
protected bool canBeExtracted(string $file)

Parameters

string $file

Return Value

bool

Exceptions

InvalidArgumentException

at line 260
protected array extractFromDirectory(string|array $directory)

Parameters

string|array $directory

Return Value

array files to be extracted

at line 80
extract(string|array $resource, MessageCatalogue $catalog)

Extracts translation messages from files, a file or a directory to the catalogue.

Parameters

string|array $resource Files, a file or a directory
MessageCatalogue $catalog

at line 94
setPrefix(string $prefix)

Sets the prefix that should be used for new found messages.

Parameters

string $prefix The prefix

at line 106
protected string normalizeToken(mixed $token)

Normalizes a token.

Parameters

mixed $token

Return Value

string

at line 202
protected parseTokens(array $tokens, MessageCatalogue $catalog)

Extracts trans message from PHP tokens.

Parameters

array $tokens
MessageCatalogue $catalog