Class lajax\projectscanner\scanners\PhpArrayScanner
Inheritance | lajax\projectscanner\scanners\PhpArrayScanner » lajax\projectscanner\scanners\FileScannerAbstract » yii\base\Object |
---|---|
Implements | lajax\projectscanner\scanners\ScannerInterface |
Available since version | 1.0 |
Class for processing PHP files.
Language elements detected in constant arrays:
/**
* @translate
*/
private $_GENDERS = ['Male', 'Female'];
/**
* @translate
*/
private $_STATUSES = [
self::STATUS_ACTIVE => 'Active',
self::STATUS_INACTIVE => 'Inactive'
];
Translation of constant arrays: Translation to site language:
$genders = \lajax\translatemanager\helpers\Language::a($this->_GENDERS);
Translating to the language of your coice:
$statuses = \lajax\translatemanager\helpers\Language::a($this->_STATUSES, [], 'de-DE');
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$category | string | Default Php Array category. | lajax\projectscanner\scanners\PhpArrayScanner |
$extension | string | Extension of PHP files. | lajax\projectscanner\scanners\FileScannerAbstract |
$patternArrayTranslator | string | PHP Regular expression to match arrays containing language elements to translate. | lajax\projectscanner\scanners\PhpArrayScanner |
$scanner | lajax\projectscanner\Scanner | Object containing the detected language elements | lajax\projectscanner\scanners\FileScannerAbstract |
Protected Properties
Property | Type | Description | Defined By |
---|---|---|---|
$files | array | Array to store paths to project files. | lajax\projectscanner\scanners\FileScannerAbstract |
Public Methods
Method | Description | Defined By |
---|---|---|
execute() | Start scanning PHP files. | lajax\projectscanner\scanners\PhpArrayScanner |
scanProject() | Scanning project filesistem. | lajax\projectscanner\scanners\FileScannerAbstract |
Protected Methods
Method | Description | Defined By |
---|---|---|
checkTokens() | lajax\projectscanner\scanners\FileScannerAbstract | |
containsTranslator() | Determines whether the file has any of the translators. | lajax\projectscanner\scanners\FileScannerAbstract |
extractMessages() | Extracts messages from a file | lajax\projectscanner\scanners\FileScannerAbstract |
getLanguageItem() | Returns language elements in the token buffer. | lajax\projectscanner\scanners\PhpArrayScanner |
getTranslators() | Returns the names of the arrays storing the language elements to be translated. | lajax\projectscanner\scanners\PhpArrayScanner |
isValidCategory() | Determines whether the category received as a parameter can be processed. | lajax\projectscanner\scanners\FileScannerAbstract |
tokensEqual() | Finds out if two PHP tokens are equal | lajax\projectscanner\scanners\FileScannerAbstract |
Property Details
Default Php Array category.
PHP Regular expression to match arrays containing language elements to translate.
Method Details
Start scanning PHP files.
public void execute ( ) |
Returns language elements in the token buffer.
If there are no recognisable language elements in the array, returns null
protected array|null getLanguageItem ( $buffer ) | ||
$buffer | array |
Returns the names of the arrays storing the language elements to be translated.
protected array getTranslators ( $file ) | ||
$file | string | Path to the file to scan. |
return | array | List of arrays storing the language elements to be translated. |
---|