PHP Class Cake\Shell\Task\ExtractTask

Inheritance: extends Cake\Console\Shell
Afficher le fichier Open project: cakephp/cakephp Class Usage Examples

Protected Properties

Свойство Type Description
$_exclude array An array of directories to exclude.
$_extractCore boolean Holds whether this call should extract the CakePHP Lib messages
$_file string Current file being processed
$_files array Files from where to extract
$_merge boolean Merge all domain strings into the default.pot file
$_output string Destination path
$_paths array Paths to use when looking for strings
$_storage array Contains all content waiting to be write
$_tokens array Extracted tokens
$_translations array Extracted strings indexed by domain.
$_validationDomain boolean Holds the validation string domain to use for validation messages when extracting

Méthodes publiques

Méthode Description
getOptionParser ( ) : Cake\Console\ConsoleOptionParser Gets the option parser instance and configures it.
main ( ) : void Execution method always used for tasks

Méthodes protégées

Méthode Description
_addTranslation ( string $domain, string $msgid, array $details = [] ) : void Add a translation to the internal translations property
_buildFiles ( ) : void Build the translate template file contents out of obtained strings
_extract ( ) : void Extract text
_extractTokens ( ) : void Extract tokens out of all files to be processed
_formatString ( string $string ) : string Format a string to be added as a translatable string
_getPaths ( ) : void Method to interact with the User and get path selections.
_getStrings ( integer &$position, integer $target ) : array Get the strings from the position forward
_isExtractingApp ( ) : boolean Returns whether this execution is meant to extract string only from directories in folder represented by the APP constant, i.e. this task is extracting strings from same application.
_isPathUsable ( string $path ) : boolean Checks whether or not a given path is usable for writing.
_markerError ( string $file, integer $line, string $marker, integer $count ) : void Indicate an invalid marker on a processed file
_parse ( string $functionName, array $map ) : void Parse tokens
_searchFiles ( ) : void Search files that may contain translatable strings
_store ( string $domain, string $header, string $sentence ) : void Prepare a file to be stored
_welcome ( ) : void No welcome message.
_writeFiles ( ) : void Write the files that need to be stored
_writeHeader ( ) : string Build the translation template header

Method Details

_addTranslation() protected méthode

Takes care of duplicate translations
protected _addTranslation ( string $domain, string $msgid, array $details = [] ) : void
$domain string The domain
$msgid string The message string
$details array Context and plural form if any, file and line references
Résultat void

_buildFiles() protected méthode

Build the translate template file contents out of obtained strings
protected _buildFiles ( ) : void
Résultat void

_extract() protected méthode

Extract text
protected _extract ( ) : void
Résultat void

_extractTokens() protected méthode

Extract tokens out of all files to be processed
protected _extractTokens ( ) : void
Résultat void

_formatString() protected méthode

Format a string to be added as a translatable string
protected _formatString ( string $string ) : string
$string string String to format
Résultat string Formatted string

_getPaths() protected méthode

Method to interact with the User and get path selections.
protected _getPaths ( ) : void
Résultat void

_getStrings() protected méthode

Get the strings from the position forward
protected _getStrings ( integer &$position, integer $target ) : array
$position integer Actual position on tokens array
$target integer Number of strings to extract
Résultat array Strings extracted

_isExtractingApp() protected méthode

Returns whether this execution is meant to extract string only from directories in folder represented by the APP constant, i.e. this task is extracting strings from same application.
protected _isExtractingApp ( ) : boolean
Résultat boolean

_isPathUsable() protected méthode

Checks whether or not a given path is usable for writing.
protected _isPathUsable ( string $path ) : boolean
$path string Path to folder
Résultat boolean true if it exists and is writable, false otherwise

_markerError() protected méthode

Indicate an invalid marker on a processed file
protected _markerError ( string $file, integer $line, string $marker, integer $count ) : void
$file string File where invalid marker resides
$line integer Line number
$marker string Marker found
$count integer Count
Résultat void

_parse() protected méthode

Parse tokens
protected _parse ( string $functionName, array $map ) : void
$functionName string Function name that indicates translatable string (e.g: '__')
$map array Array containing what variables it will find (e.g: domain, singular, plural)
Résultat void

_searchFiles() protected méthode

Search files that may contain translatable strings
protected _searchFiles ( ) : void
Résultat void

_store() protected méthode

Prepare a file to be stored
protected _store ( string $domain, string $header, string $sentence ) : void
$domain string The domain
$header string The header content.
$sentence string The sentence to store.
Résultat void

_welcome() protected méthode

No welcome message.
protected _welcome ( ) : void
Résultat void

_writeFiles() protected méthode

Write the files that need to be stored
protected _writeFiles ( ) : void
Résultat void

_writeHeader() protected méthode

Build the translation template header
protected _writeHeader ( ) : string
Résultat string Translation template header

getOptionParser() public méthode

Gets the option parser instance and configures it.
public getOptionParser ( ) : Cake\Console\ConsoleOptionParser
Résultat Cake\Console\ConsoleOptionParser

main() public méthode

Execution method always used for tasks
public main ( ) : void
Résultat void

Property Details

$_exclude protected_oe property

An array of directories to exclude.
protected array $_exclude
Résultat array

$_extractCore protected_oe property

Holds whether this call should extract the CakePHP Lib messages
protected bool $_extractCore
Résultat boolean

$_file protected_oe property

Current file being processed
protected string $_file
Résultat string

$_files protected_oe property

Files from where to extract
protected array $_files
Résultat array

$_merge protected_oe property

Merge all domain strings into the default.pot file
protected bool $_merge
Résultat boolean

$_output protected_oe property

Destination path
protected string $_output
Résultat string

$_paths protected_oe property

Paths to use when looking for strings
protected array $_paths
Résultat array

$_storage protected_oe property

Contains all content waiting to be write
protected array $_storage
Résultat array

$_tokens protected_oe property

Extracted tokens
protected array $_tokens
Résultat array

$_translations protected_oe property

Extracted strings indexed by domain.
protected array $_translations
Résultat array

$_validationDomain protected_oe property

Holds the validation string domain to use for validation messages when extracting
protected bool $_validationDomain
Résultat boolean