Class lajax\translatemanager\services\scanners\ScannerPhpArray

Inheritancelajax\translatemanager\services\scanners\ScannerPhpArray » lajax\translatemanager\services\scanners\ScannerFile » yii\console\controllers\MessageController
Available since version1.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');

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$files array Array to store patsh to project files. lajax\translatemanager\services\scanners\ScannerFile

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
checkTokens() lajax\translatemanager\services\scanners\ScannerFile
extractMessages() Extracts messages from a file lajax\translatemanager\services\scanners\ScannerFile
getLanguageItem() Returns language elements in the token buffer. lajax\translatemanager\services\scanners\ScannerPhpArray
isValidCategory() Determines whether the category received as a parameter can be processed. lajax\translatemanager\services\scanners\ScannerFile


Hide inherited constants

ConstantValueDescriptionDefined By
EXTENSION '*.php' Extension of PHP files. lajax\translatemanager\services\scanners\ScannerPhpArray

Method Details

getLanguageItem() protected method

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
run() public method

Start scanning PHP files.

public void run ( $route, $params = [] )
$route string
$params array