protected function saveMessagesToPHP($messages, $dirName, $overwrite, $removeUnused, $sort, $markUnused)
    {
        foreach ($messages as $category => $msgs) {
            $file = str_replace('\\', '/', "$dirName/$category.php");
            $path = dirname($file);
            FileHelper::createDirectory($path);
            $msgs = array_values(array_unique($msgs));
            $coloredFileName = Console::ansiFormat($file, [Console::FG_CYAN]);
            $this->stdout("Saving messages to $coloredFileName...\n");
            $this->saveMessagesCategoryToPHP($msgs, $file, $overwrite, $removeUnused, $sort, $category, $markUnused);
        }
    }
protected function saveMessagesToPHP($messages, $dirName, $overwrite, $removeUnused, $sort, $markUnused)
    {
        foreach ($messages as $category => $msgs) {
            $file = str_replace('\\', '/', "$dirName/$category.php");
            $path = dirname($file);
            FileHelper::createDirectory($path);
            $msgs = array_values(array_unique($msgs));
            $coloredFileName = Console::ansiFormat($file, [Console::FG_CYAN]);
            $this->stdout("Saving messages to $coloredFileName...\n");
            $this->saveMessagesCategoryToPHP($msgs, $file, $overwrite, $removeUnused, $sort, $category, $markUnused);
        }
    }
protected function saveMessagesToPHP ( $ messages , $ dirName , $ overwrite , $ removeUnused , $ sort , $ markUnused ) { foreach ( $ messages as $ category => $ msgs ) { $ file = str_replace ( '\\' , '/' , "$dirName/$category.php" ) ; $ path = dirname ( $ file ) ; FileHelper :: createDirectory ( $ path ) ; $ msgs = array_values ( array_unique ( $ msgs ) ) ; $ coloredFileName = Console :: ansiFormat ( $ file , [ Console :: FG_CYAN ] ) ; $ this -> stdout ( "Saving messages to $coloredFileName...\n" ) ; $ this -> saveMessagesCategoryToPHP ( $ msgs , $ file , $ overwrite , $ removeUnused , $ sort , $ category , $ markUnused ) ; } }
Writes messages into PHP files.

@param array $messages
@param string $dirName name of the directory to write to
@param bool $overwrite if existing file should be overwritten without backup
@param bool $removeUnused if obsolete translations should be removed
@param bool $sort if translations should be sorted
@param bool $markUnused if obsolete translations should be marked
Writes messages into PHP files .