/** * Echo shortcut but with a encoding conversion before output * * @param string $output The string to output in the console * @param string $prefix A prefix to add to teh output DEFAULT '' * * @static */ public static function out(string $output, string $prefix = '') { Ini::setIniFileName(Ini::INI_CONF_FILE); $environment = Ini::getParam('Environment', 'environment'); if (!isset($_SERVER['REQUEST_URI'])) { $environment = 'console'; } switch ($environment) { case 'console': echo mb_convert_encoding($prefix . $output, static::$echoEncoding); break; case 'web': foreach (preg_split('/' . PHP_EOL . '/', ConsoleColors::unsetColor($output)) as $line) { // Console::log($line); echo $line; } break; default: echo $prefix . $output; break; } }