} if (false === $dataDir) { fwrite(STDERR, 'Unable to find data dir.'); exit(11); } $consoleDefFile = is_file($dataDir . '/roscon.xml') ? $dataDir . '/roscon.xml' : false; if (false === $consoleDefFile) { fwrite(STDERR, <<<HEREDOC The console definition file (roscon.xml) was not found at the data dir, which was found to be at {$dataDir} HEREDOC ); exit(12); } $cmdParser = CommandLine::fromXmlFile($consoleDefFile); try { $cmd = $cmdParser->parse(); } catch (CommandLine\Exception $e) { fwrite(STDERR, 'Error when parsing command line: ' . $e->getMessage() . "\n"); $cmdParser->displayUsage(13); } $comTimeout = null === $cmd->options['conTime'] ? null === $cmd->options['time'] ? (int) ini_get('default_socket_timeout') : $cmd->options['time'] : $cmd->options['conTime']; $cmd->options['time'] = $cmd->options['time'] ?: 3; $comContext = null === $cmd->options['caPath'] ? null : stream_context_create(is_file($cmd->options['caPath']) ? array('ssl' => array('verify_peer' => true, 'cafile' => $cmd->options['caPath'])) : array('ssl' => array('verify_peer' => true, 'capath' => $cmd->options['caPath']))); $cColors = array('SEND' => '', 'SENT' => '', 'RECV' => '', 'ERR' => '', 'NOTE' => '', '' => ''); if ('auto' === $cmd->options['isColored']) { $cmd->options['isColored'] = (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' || getenv('ANSICON_VER') != false) && class_exists('PEAR2\\Console\\Color', true) ? 'yes' : 'no'; } if ('yes' === $cmd->options['isColored']) { if (class_exists('PEAR2\\Console\\Color', true)) {