Пример #1
0
 public function format($response)
 {
     $response->getHeaders()->set('Content-Type', 'text/php; charset=UTF-8');
     if ($response->data !== null) {
         $response->content = "<?php\nreturn " . VarDumper::export($response->data) . ";\n";
     }
 }
Пример #2
0
 /**
  * Stores log messages to DB.
  */
 public function export()
 {
     $tableName = $this->db->quoteTableName($this->logTable);
     $sql = "INSERT INTO {$tableName} ([[level]], [[category]], [[log_time]], [[prefix]], [[message]], [[model]], [[blame]])\n                VALUES (:level, :category, :log_time, :prefix, :message, :model, :blame)";
     $command = $this->db->createCommand($sql);
     foreach ($this->messages as $message) {
         list($text, $level, $category, $timestamp) = $message;
         $extracted = ['msg' => '', 'model' => null, 'blame' => null];
         if (is_array($text) && (isset($text['msg']) || isset($text['model']) || isset($text['blame']))) {
             if (isset($text['msg'])) {
                 if (!is_string($text['msg'])) {
                     $extracted['msg'] = VarDumper::export($text['msg']);
                 } else {
                     $extracted['msg'] = $text['msg'];
                 }
             }
             if (isset($text['model'])) {
                 $extracted['model'] = $text['model'];
             }
             if (isset($text['blame'])) {
                 $extracted['blame'] = $text['blame'];
             }
         } elseif (is_string($text)) {
             $extracted['msg'] = $text;
         } else {
             $extracted['msg'] = VarDumper::export($text);
         }
         $command->bindValues([':level' => $level, ':category' => $category, ':log_time' => $timestamp, ':prefix' => $this->getMessagePrefix($message), ':message' => $extracted['msg'], ':model' => $extracted['model'], ':blame' => $extracted['blame']])->execute();
     }
 }
Пример #3
0
 /**
  * @return array all directories
  */
 protected function getDirectories()
 {
     if ($this->_paths === null) {
         $paths = ArrayHelper::getValue(Yii::$app->params, $this->paramVar, []);
         $paths = array_merge($paths, $this->migrationLookup);
         $extra = !empty($this->extraFile) && is_file($this->extraFile = Yii::getAlias($this->extraFile)) ? require $this->extraFile : [];
         $paths = array_merge($extra, $paths);
         $p = [];
         foreach ($paths as $path) {
             $p[Yii::getAlias($path, false)] = true;
         }
         unset($p[false]);
         $currentPath = Yii::getAlias($this->migrationPath);
         if (!isset($p[$currentPath])) {
             $p[$currentPath] = true;
             if (!empty($this->extraFile)) {
                 $extra[] = $this->migrationPath;
                 FileHelper::createDirectory(dirname($this->extraFile));
                 file_put_contents($this->extraFile, "<?php\nreturn " . VarDumper::export($extra) . ";\n", LOCK_EX);
             }
         }
         $this->_paths = array_keys($p);
         foreach ($this->migrationNamespaces as $namespace) {
             $path = str_replace('/', DIRECTORY_SEPARATOR, Yii::getAlias('@' . str_replace('\\', '/', $namespace)));
             $this->_paths[$namespace] = $path;
         }
     }
     return $this->_paths;
 }
    /**
     * Writes all configuration to application configuration file
     * @return bool result, true if success
     */
    public function commit()
    {
        $data = <<<PHP
<?php
/*
 * ! WARNING !
 *
 * This file is auto-generated.
 * Please don't modify it by-hand or all your changes can be lost.
 */
{$this->append}
return
PHP;
        $data .= VarDumper::export($this->configuration);
        $data .= ";\n\n";
        $result = file_put_contents($this->filename, $data, LOCK_EX) !== false;
        if ($result) {
            if (function_exists('opcache_invalidate')) {
                opcache_invalidate($this->filename, true);
            }
            if (function_exists('apc_delete_file')) {
                @apc_delete_file($this->filename);
            }
        }
        return $result;
    }
 /**
  * Creates message command config file named as [[configFileName]].
  * @param array $config message command config.
  */
 protected function saveConfigFile(array $config)
 {
     if (file_exists($this->configFileName)) {
         unlink($this->configFileName);
     }
     $fileContent = '<?php return ' . VarDumper::export($config) . ';';
     file_put_contents($this->configFileName, $fileContent);
 }
Пример #6
0
 /**
  * Write database configuration content in a file
  *
  * @param $config
  * @return bool
  */
 public static function createDatabaseConfigFile($config)
 {
     $content = VarDumper::export($config);
     $content = preg_replace('~\\\\+~', '\\', $content);
     // Fix class backslash
     $content = "<?php\nreturn " . $content . ";\n";
     return file_put_contents(Yii::getAlias('@app/config/db.php'), $content) > 0;
 }
Пример #7
0
 public static function writeCommonConfig(FinalStep $model)
 {
     $common_config = ['language' => Yii::$app->session->get('language'), 'components' => ['cache' => ['class' => $model->cacheClass, 'keyPrefix' => $model->keyPrefix]], 'modules' => ['core' => ['serverName' => $model->serverName, 'serverPort' => $model->serverPort]]];
     if ($model->cacheClass === 'yii\\caching\\MemCache') {
         $common_config['components']['cache']['useMemcached'] = $model->useMemcached;
     }
     return file_put_contents(Yii::getAlias('@app/config/common-local.php'), "<?php\nreturn " . VarDumper::export($common_config) . ';') > 0;
 }
Пример #8
0
 /**
  * @inheritdoc
  */
 public function writeData($fileName, array $data)
 {
     $fileName = $this->composeActualFileName($fileName);
     $content = "<?php\n\nreturn " . VarDumper::export($data) . ";";
     $bytesWritten = file_put_contents($fileName, $content);
     if ($bytesWritten <= 0) {
         throw new Exception("Unable to write file '{$fileName}'.");
     }
 }
Пример #9
0
 public function setRuntimeConfig($config)
 {
     $path = $this->runtimeConfigDir();
     if (!is_dir($path)) {
         FileHelper::createDirectory($path);
     }
     $data = '<?php ' . "\nreturn " . VarDumper::export($config) . ';';
     file_put_contents($path . DIRECTORY_SEPARATOR . 'config.php', $data);
 }
Пример #10
0
 /**
  * @inheritdoc
  */
 public function formatMessage($message)
 {
     list($text, $level, $category, $timestamp) = $message;
     $level = Logger::getLevelName($level);
     if (!is_string($text)) {
         $text = VarDumper::export($text);
     }
     $prefix = $this->getMessagePrefix($message);
     return "{$prefix}[{$level}][{$category}] {$text}";
 }
 /**
  * @inheritdoc
  */
 public function export()
 {
     foreach ($this->messages as $message) {
         list($text, $level, $category, $timestamp) = $message;
         if (!is_string($text)) {
             $text = VarDumper::export($text);
         }
         $this->sendLog($text);
     }
 }
Пример #12
0
 /**
  * Stores log messages to MongoDB collection.
  */
 public function export()
 {
     $collection = $this->db->getCollection($this->logCollection);
     foreach ($this->messages as $message) {
         list($text, $level, $category, $timestamp) = $message;
         if (!is_string($text)) {
             $text = VarDumper::export($text);
         }
         $collection->insert(['level' => $level, 'category' => $category, 'log_time' => $timestamp, 'prefix' => $this->getMessagePrefix($message), 'message' => $text]);
     }
 }
Пример #13
0
 /**
  * @inheritdoc
  */
 public function match($value)
 {
     if (!is_scalar($value)) {
         $value = VarDumper::export($value);
     }
     if ($this->partial) {
         return mb_stripos($value, $this->baseValue, 0, \Yii::$app->charset) !== false;
     } else {
         return strcmp(mb_strtoupper($this->baseValue, \Yii::$app->charset), mb_strtoupper($value, \Yii::$app->charset)) === 0;
     }
 }
Пример #14
0
 public function saveConfig()
 {
     $this->beforeSave();
     $conf = $this->getAttributes();
     unset($conf['blockId'], $conf['widgetId'], $conf['comment']);
     $conf['__block'] = ['widgetId' => $this->widgetId, 'comment' => $this->comment, 'widgetClass' => DynBlockHelper::widgetClassById($this->widgetId, true), 'modelClass' => DynBlockHelper::widgetModelClassNameById($this->widgetId)];
     $s = VarDumper::export($conf);
     $s = "<?php\nreturn " . $s . ";";
     $fn = DynBlockHelper::configFile($this->blockId);
     file_put_contents($fn, $s);
 }
Пример #15
0
 /**
  * Constructor.
  *
  * @param Item $item
  * @param array $config
  */
 public function __construct($item, $config = [])
 {
     $this->_item = $item;
     if ($item !== null) {
         $this->name = $item->name;
         $this->type = (int) $item->type;
         $this->description = $item->description;
         $this->ruleName = $item->ruleName;
         $this->data = $item->data === null ? null : VarDumper::export($item->data);
     }
     parent::__construct($config);
 }
Пример #16
0
 /**
  * Stores log messages to DB.
  */
 public function export()
 {
     $tableName = $this->db->quoteTableName($this->logTable);
     $sql = "INSERT INTO {$tableName} ([[level]], [[category]], [[log_time]], [[prefix]], [[message]])\n                VALUES (:level, :category, :log_time, :prefix, :message)";
     $command = $this->db->createCommand($sql);
     foreach ($this->messages as $message) {
         list($text, $level, $category, $timestamp) = $message;
         if (!is_string($text)) {
             $text = VarDumper::export($text);
         }
         $command->bindValues([':level' => $level, ':category' => $category, ':log_time' => $timestamp, ':prefix' => $this->getMessagePrefix($message), ':message' => $text])->execute();
     }
 }
Пример #17
0
 /**
  * @inheritdoc
  */
 protected function saveMessages($messages, $category)
 {
     $fileName = $this->getMessageFilePath($category);
     if (file_exists($fileName)) {
         unlink($fileName);
     } else {
         $dirName = dirname($fileName);
         if (!file_exists($dirName)) {
             mkdir($dirName, 0777, true);
         }
     }
     $fileContent = '<?php return ' . VarDumper::export($messages) . ';';
     file_put_contents($fileName, $fileContent);
 }
Пример #18
0
 public function formatMessage($message)
 {
     list($text, $level, $category, $timestamp) = $message;
     $level = Logger::getLevelName($level);
     if (!is_string($text)) {
         // exceptions may not be serializable if in the call stack somewhere is a Closure
         if ($text instanceof \Exception) {
             $text = (string) $text;
         } else {
             $text = VarDumper::export($text);
         }
     }
     $prefix = $this->getMessagePrefix($message);
     return "Level: " . ucfirst($level) . " \n\n Time: " . date('F j, Y, g:i a (T)', $timestamp) . "\n\n Message:\n {$text} \n\n {$prefix} \n\n";
 }
Пример #19
0
 /**
  * @inheritdoc
  */
 public function formatMessage($message)
 {
     list($text, $level, $category, $timestamp) = $message;
     $level = Logger::getLevelName($level);
     if (!is_string($text)) {
         // exceptions may not be serializable if in the call stack somewhere is a Closure
         if ($text instanceof \Throwable || $text instanceof \Exception) {
             $text = (string) $text;
         } else {
             $text = VarDumper::export($text);
         }
     }
     $prefix = $this->getMessagePrefix($message);
     return "{$prefix}[{$level}][{$category}] {$text}";
 }
Пример #20
0
 /**
  * Stores log messages to MongoDB collection.
  */
 public function export()
 {
     $collection = $this->db->getCollection($this->logCollection);
     foreach ($this->messages as $message) {
         list($text, $level, $category, $timestamp) = $message;
         if (!is_string($text)) {
             // exceptions may not be serializable if in the call stack somewhere is a Closure
             if ($text instanceof \Exception) {
                 $text = (string) $text;
             } else {
                 $text = VarDumper::export($text);
             }
         }
         $collection->insert(['level' => $level, 'category' => $category, 'log_time' => $timestamp, 'prefix' => $this->getMessagePrefix($message), 'message' => $text]);
     }
 }
Пример #21
0
    /**
     * @param string $outFile the file to update. Defaults to @yii/helpers/mimeTypes.php
     */
    public function actionIndex($outFile = null)
    {
        if ($outFile === null) {
            $outFile = Yii::getAlias('@yii/helpers/mimeTypes.php');
        }
        $this->stdout('downloading mime-type file from apache httpd repository...');
        if ($content = file_get_contents('http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/conf/mime.types?view=co')) {
            $this->stdout("done.\n", Console::FG_GREEN);
            $this->stdout("generating file {$outFile}...");
            $mimeMap = [];
            foreach (explode("\n", $content) as $line) {
                $line = trim($line);
                if (empty($line) || $line[0] == '#') {
                    // skip comments and empty lines
                    continue;
                }
                $parts = preg_split('/\\s+/', $line);
                $mime = array_shift($parts);
                foreach ($parts as $ext) {
                    if (!empty($ext)) {
                        $mimeMap[$ext] = $mime;
                    }
                }
            }
            ksort($mimeMap);
            $array = VarDumper::export($mimeMap);
            $content = <<<EOD
<?php
/**
 * MIME types.
 *
 * This file contains most commonly used MIME types
 * according to file extension names.
 * Its content is generated from the apache http mime.types file.
 * http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/conf/mime.types?view=markup
 * This file has been placed in the public domain for unlimited redistribution.
 */
return {$array};

EOD;
            file_put_contents($outFile, $content);
            $this->stdout("done.\n", Console::FG_GREEN);
        } else {
            $this->stderr("Failed to download mime.types file from apache SVN.\n");
        }
    }
Пример #22
0
 /**
  * Stores log messages to DB.
  */
 public function export()
 {
     $tableName = $this->db->quoteTableName($this->logTable);
     $sql = "INSERT INTO {$tableName} ([[level]], [[category]], [[log_time]], [[prefix]], [[message]])\n                VALUES (:level, :category, :log_time, :prefix, :message)";
     $command = $this->db->createCommand($sql);
     foreach ($this->messages as $message) {
         list($text, $level, $category, $timestamp) = $message;
         if (!is_string($text)) {
             // exceptions may not be serializable if in the call stack somewhere is a Closure
             if ($text instanceof \Exception) {
                 $text = (string) $text;
             } else {
                 $text = VarDumper::export($text);
             }
         }
         $command->bindValues([':level' => $level, ':category' => $category, ':log_time' => $timestamp, ':prefix' => $this->getMessagePrefix($message), ':message' => $text])->execute();
     }
 }
Пример #23
0
    /**
     * @param string $messagePath
     * @param string $category
     * @throws Exception
     */
    public function actionExport($messagePath = null, $category = null)
    {
        if (!$messagePath) {
            $messagePath = $this->prompt('Enter a message path');
        }
        $messagePath = realpath(Yii::getAlias($messagePath));
        if (!is_dir($messagePath)) {
            throw new Exception('The message path ' . $messagePath . ' is not a valid directory.');
        }
        if (!$category) {
            $category = $this->prompt('Enter an exporting category');
        }
        if (empty($category)) {
            throw new Exception('The $category is empty.');
        }
        $sourceMessages = SourceMessage::find()->where('category = :category', [':category' => $category])->orderBy('message')->all();
        $messages = [];
        foreach ($sourceMessages as $sourceMessage) {
            $translations = $sourceMessage->messages;
            foreach (Yii::$app->getI18n()->languages as $language) {
                $messages[$language][$sourceMessage['message']] = isset($translations[$language]) && !empty($translations[$language]['translation']) ? $translations[$language]['translation'] : '';
            }
        }
        foreach ($messages as $language => $translations) {
            $translationsFile = FileHelper::normalizePath($messagePath . DIRECTORY_SEPARATOR . $language . DIRECTORY_SEPARATOR . str_replace('\\', '/', $category) . '.php');
            if (!is_file($translationsFile)) {
                $dir = dirname($translationsFile);
                if (!FileHelper::createDirectory($dir)) {
                    throw new Exception('Directory ' . $dir . ' is not created');
                }
            }
            ksort($translations);
            $array = VarDumper::export($translations);
            $content = <<<EOD
<?php

return {$array};

EOD;
            file_put_contents($translationsFile, $content);
            echo PHP_EOL . 'Saved to ' . $translationsFile . PHP_EOL;
        }
    }
Пример #24
0
 /**
  * @inheritdoc
  */
 public function formatMessage($message)
 {
     list($text, $level, $category, $timestamp) = $message;
     if (!is_string($text)) {
         // exceptions may not be serializable if in the call stack somewhere is a Closure
         if ($text instanceof \Exception) {
             $text = (string) $text;
         } else {
             $text = VarDumper::export($text);
         }
     }
     $traces = [];
     if (isset($message[4])) {
         foreach ($message[4] as $trace) {
             $traces[] = "in {$trace['file']}:{$trace['line']}";
         }
     }
     return $text . (empty($traces) ? '' : "\n    " . implode("\n    ", $traces));
 }
Пример #25
0
 /**
  * (non-PHPdoc)
  * @see \yii\log\Target::formatMessage()
  */
 public function formatMessage($message)
 {
     if (!$this->with_microtime) {
         return parent::formatMessage($message);
     }
     list($text, $level, $category, $timestamp) = $message;
     $level = \yii\log\Logger::getLevelName($level);
     if (!is_string($text)) {
         $text = VarDumper::export($text);
     }
     $traces = [];
     if (isset($message[4])) {
         foreach ($message[4] as $trace) {
             $traces[] = "in {$trace['file']}:{$trace['line']}";
         }
     }
     $prefix = $this->getMessagePrefix($message);
     return (new \DateTime())->setTimestamp($timestamp)->format('Y-m-d H:i:s') . ':' . str_pad(round(($timestamp - floor($timestamp)) * 1000000), 6, '0', STR_PAD_RIGHT) . " {$prefix}[{$level}][{$category}] {$text}" . (empty($traces) ? '' : "\n    " . implode("\n    ", $traces));
 }
Пример #26
0
 /**
  * Exports log [[messages]] to a specific destination.
  * Child classes must implement this method.
  */
 public function export()
 {
     foreach ($this->messages as $message) {
         list($text, $level, $category, $timestamp) = $message;
         if (!is_string($text)) {
             // exceptions may not be serializable if in the call stack somewhere is a Closure
             if ($text instanceof \Throwable || $text instanceof \Exception) {
                 $text = (string) $text;
             } else {
                 $text = VarDumper::export($text);
             }
         }
         $string = "[{$level}][{$category}] {$text}";
         if ($level == Logger::LEVEL_ERROR) {
             Console::stderr($string);
         } else {
             Console::stdout($string);
         }
     }
 }
 /**
  * Formats a log message for display as a string.
  * @param array $message the log message to be formatted.
  * The message structure follows that in [[Logger::messages]].
  * @return string the formatted message
  */
 public function formatMessage($message)
 {
     list($text, $level, $category, $timestamp) = $message;
     $level = Logger::getLevelName($level);
     if (!is_string($text)) {
         // exceptions may not be serializable if in the call stack somewhere is a Closure
         if ($text instanceof \Throwable || $text instanceof \Exception) {
             $text = sprintf('[%s] %s', $text->getCode(), $text->getMessage());
         } elseif (is_array($text)) {
             /*
              * Only VarDump if array, don't want to inadvertently log objects with sensitive info
              */
             $text = VarDumper::export($text);
         } else {
             $text = sprintf('Unsupported object of type %s sent to logger', get_class($text));
         }
     }
     $prefix = $this->getMessagePrefix($message);
     return date('Y-m-d H:i:s', $timestamp) . " {$prefix}[{$level}][{$category}] {$text}";
 }
Пример #28
0
 /**
  * Formats a log message for display as a string.
  * @param array $message the log message to be formatted.
  * The message structure follows that in Logger::messages.
  * @return string the formatted message
  */
 public function formatMessage($message)
 {
     list($text, $level, $category, $timestamp) = $message;
     $level = Logger::getLevelName($level);
     if (!is_string($text)) {
         // exceptions may not be serializable if in the call stack somewhere is a Closure
         if ($text instanceof \Exception) {
             $text = (string) $text;
         } else {
             $text = VarDumper::export($text);
         }
     }
     $traces = [];
     if (isset($message[4])) {
         foreach ($message[4] as $trace) {
             $traces[] = "in {$trace['file']}:{$trace['line']}";
         }
     }
     $prefix = $this->getMessagePrefix($message);
     return date('Y-m-d H:i:s', $timestamp) . '.' . (strpos($timestamp, '.') ? str_pad(explode('.', (string) $timestamp)[1], 10, '0') : '0000000000') . " {$prefix}[{$level}][{$category}] {$text}" . (empty($traces) ? '' : "\n    " . implode("\n    ", $traces));
 }
    /**
     * Combines and compresses all files into one for each AssetBundle.
     * @param string $configFile Output config file with processed bundles
     * @throws \yii\base\Exception
     * @throws \yii\base\InvalidConfigException
     */
    public function actionCombine($configFile)
    {
        // Remove existing config
        if (file_exists($configFile)) {
            unlink($configFile);
        }
        $bundles = [];
        $path = \Yii::getAlias($this->assetsDir);
        $files = FileHelper::findFiles($path, ['recursive' => $this->recursive]);
        foreach ($files as $file) {
            $namespace = $this->assetsNamespace . ltrim(str_replace('/', '\\', substr(dirname($file), strlen($path))), '\\');
            $this->bundles[] = rtrim($namespace, '\\') . '\\' . pathinfo($file, PATHINFO_FILENAME);
        }
        $this->bundles = array_unique($this->bundles);
        foreach ($this->bundles as $name) {
            $this->stdout("Creating output bundle ");
            $this->stdout("'{$name}'", Console::FG_YELLOW);
            $this->stdout(": ");
            $bundles[$name] = $this->assembleBundle($name);
            $this->stdout("OK\n", Console::FG_GREEN);
        }
        $array = VarDumper::export($bundles);
        $version = date('Y-m-d H:i:s');
        $configFileContent = <<<EOD
<?php
/**
 * This file is generated by the "yii {$this->id}" command.
 * DO NOT MODIFY THIS FILE DIRECTLY.
 * @version {$version}
 */
return {$array};
EOD;
        if (!file_put_contents($configFile, $configFileContent)) {
            throw new Exception("Unable to write output bundle configuration at '{$configFile}'.");
        }
        $this->stdout("Output bundle configuration created at '{$configFile}'.\n", Console::FG_GREEN);
        $this->stdout("Executuion time: ");
        $this->stdout(round(Yii::getLogger()->getElapsedTime(), 3) . " s.\n", Console::FG_CYAN);
    }
Пример #30
0
    /**
     * Writes category messages into PHP file
     *
     * @param array $messages
     * @param string $fileName name of the file to write to
     * @param boolean $overwrite if existing file should be overwritten without backup
     * @param boolean $removeUnused if obsolete translations should be removed
     * @param boolean $sort if translations should be sorted
     * @param string $category message category
     */
    protected function saveMessagesCategoryToPHP($messages, $fileName, $overwrite, $removeUnused, $sort, $category)
    {
        if (is_file($fileName)) {
            $existingMessages = (require $fileName);
            sort($messages);
            ksort($existingMessages);
            if (array_keys($existingMessages) == $messages) {
                $this->stdout("Nothing new in \"{$category}\" category... Nothing to save.\n\n", Console::FG_GREEN);
                return;
            }
            $merged = [];
            $untranslated = [];
            foreach ($messages as $message) {
                if (array_key_exists($message, $existingMessages) && $existingMessages[$message] !== '') {
                    $merged[$message] = $existingMessages[$message];
                } else {
                    $untranslated[] = $message;
                }
            }
            ksort($merged);
            sort($untranslated);
            $todo = [];
            foreach ($untranslated as $message) {
                $todo[$message] = '';
            }
            ksort($existingMessages);
            foreach ($existingMessages as $message => $translation) {
                if (!$removeUnused && !isset($merged[$message]) && !isset($todo[$message])) {
                    if (!empty($translation) && strncmp($translation, '@@', 2) === 0 && substr_compare($translation, '@@', -2, 2) === 0) {
                        $todo[$message] = $translation;
                    } else {
                        $todo[$message] = '@@' . $translation . '@@';
                    }
                }
            }
            $merged = array_merge($todo, $merged);
            if ($sort) {
                ksort($merged);
            }
            if (false === $overwrite) {
                $fileName .= '.merged';
            }
            $this->stdout("Translation merged.\n");
        } else {
            $merged = [];
            foreach ($messages as $message) {
                $merged[$message] = '';
            }
            ksort($merged);
        }
        $array = VarDumper::export($merged);
        $content = <<<EOD
<?php
/**
 * Message translations.
 *
 * This file is automatically generated by 'yii {$this->id}' command.
 * It contains the localizable messages extracted from source code.
 * You may modify this file by translating the extracted messages.
 *
 * Each array element represents the translation (value) of a message (key).
 * If the value is empty, the message is considered as not translated.
 * Messages that no longer need translation will have their translations
 * enclosed between a pair of '@@' marks.
 *
 * Message string can be used with plural forms format. Check i18n section
 * of the guide for details.
 *
 * NOTE: this file must be saved in UTF-8 encoding.
 */
return {$array};

EOD;
        file_put_contents($fileName, $content);
        $this->stdout("Translation saved.\n\n", Console::FG_GREEN);
    }