Property | Type | Description | |
---|---|---|---|
$messageBag | Potsky\LaravelLocalizationHelpers\Factory\MessageBagInterface | ||
$translator | Potsky\LaravelLocalizationHelpers\Factory\TranslatorInterface |
Method | Description | |
---|---|---|
__construct ( Potsky\LaravelLocalizationHelpers\Factory\MessageBagInterface $messageBag ) | ||
convertLemmaToFlatArray ( array $lemmas ) : array | ||
convertLemmaToStructuredArray ( array $lemmas ) : array | ||
deleteBackupFiles ( string $lang_folder_path, integer $days, boolean | false $dryRun = false, string $ext = 'php' ) : boolean | Delete backup files | |
extractTranslationFromPhpFile ( string $path, array $trans_methods ) : array | Extract all translations from the provided file | |
extractTranslationsFromFolders ( array $folders, array $trans_methods, string $php_file_extension = 'php' ) : array | Extract all translations from the provided folders | |
findLemma ( string $lemma, array $folders, array $trans_methods, boolean | false $regex = false, boolean | false $shortOutput = false, string $ext = 'php' ) : array | false | Get the list of PHP code files where a lemma is defined | |
fixCodeStyle ( $filePath, array $fixers, $level = null ) | Fix Code Style for a file or a directory | |
getBackupDate ( integer $offsetDay ) : boolean | string | ||
getBackupFiles ( string $lang_directory, string $ext = 'php' ) : array | Return all lang backup files | |
getBackupPath ( string $file_lang_path, string $date, string $ext = 'php' ) : mixed | Get the backup file path according to the current file path | |
getFilesWithExtension ( string $path, string $ext = 'php' ) : array | Return an iterator of files with specific extension in the provided paths and subpaths | |
getLangPath ( $lang_folder_path = null ) : string | Get the lang directory path | |
getMessageBag ( ) : Potsky\LaravelLocalizationHelpers\Factory\MessageBagInterface | Get the current used message bag for facades essentially | |
getPath ( string | array $path ) : array | Return an absolute path without predefined variables | |
getShortPath ( string $path ) : string | Return an relative path to the laravel directory | |
isAFixer ( string $fixer ) : boolean | Tell if the provided fixer is a valid fixer | |
isALevel ( string $level ) : boolean | Tell if the provided level is a valid level | |
isDateOlderThanDays ( DateTime $date, integer $days ) : boolean | ||
translate ( string $word, string $to, null $from = null ) : mixed |
Method | Description | |
---|---|---|
getBackupFileDate ( string $file, string $ext = 'php' ) : DateTime | null | Return the date of a backup file |
public __construct ( Potsky\LaravelLocalizationHelpers\Factory\MessageBagInterface $messageBag ) | ||
$messageBag | Potsky\LaravelLocalizationHelpers\Factory\MessageBagInterface | A message bag or a Console object for output reports |
public convertLemmaToFlatArray ( array $lemmas ) : array | ||
$lemmas | array | an array of lemma eg: [ 'message.lemma.child' => string(83) "/Users/potsky/WTF/laravel-localization-helpers/tests/mock/trans.php" , ... ] |
return | array | a flat array of lemma eg: array(1) { 'message' => array(2) { 'lemma.child' => string(83) "/Users/potsky/Work/Private/GitHub/laravel-localization-helpers/tests/mock/trans.php" ... |
public convertLemmaToStructuredArray ( array $lemmas ) : array | ||
$lemmas | array | an array of lemma eg: [ 'message.lemma.child' => string(83) "/Users/potsky/WTF/laravel-localization-helpers/tests/mock/trans.php" , ... ] |
return | array | a structured array of lemma eg: array(1) { 'message' => array(2) { 'lemma' => array(9) { 'child' => string(83) "/Users/potsky/Work/Private/GitHub/laravel-localization-helpers/tests/mock/trans.php" ... |
public findLemma ( string $lemma, array $folders, array $trans_methods, boolean | false $regex = false, boolean | false $shortOutput = false, string $ext = 'php' ) : array | false | ||
$lemma | string | A lemma to search for or a regex to search for |
$folders | array | An array of folder to search for lemma in |
$trans_methods | array | An array of PHP lang functions |
$regex | boolean | false | Is lemma a regex ? |
$shortOutput | boolean | false | Output style for file paths |
$ext | string | |
return | array | false |
public fixCodeStyle ( $filePath, array $fixers, $level = null ) | ||
$fixers | array |
public getLangPath ( $lang_folder_path = null ) : string | ||
$lang_folder_path | ||
return | string | the path |
public getMessageBag ( ) : Potsky\LaravelLocalizationHelpers\Factory\MessageBagInterface | ||
return | Potsky\LaravelLocalizationHelpers\Factory\MessageBagInterface |
public getShortPath ( string $path ) : string | ||
$path | string | the absolute path |
return | string | the relative path |
public isDateOlderThanDays ( DateTime $date, integer $days ) : boolean | ||
$date | DateTime | |
$days | integer | |
return | boolean |
protected MessageBagInterface,Potsky\LaravelLocalizationHelpers\Factory $messageBag | ||
return | Potsky\LaravelLocalizationHelpers\Factory\MessageBagInterface |