public static function readTimeZone() { if (is_readable($tz = '/etc/timezone')) { $lines = array_filter(file($tz), function ($line) { return !preg_match('/^#/', $line); }); if (!empty($lines)) { return trim($lines[0]); } } return false; }
public function configure() { // avoid warnings when web scraping possible malformed HTML from pecl if (extension_loaded('libxml')) { libxml_use_internal_errors(true); } // prevent execution time limit fatal error set_time_limit(0); // prevent warnings when timezone is not set date_default_timezone_set(Utils::readTimeZone() ?: 'America/Los_Angeles'); // fix bold output so it looks good on light and dark terminals $this->getFormatter()->addStyle('bold', array('bold' => 1)); $this->logger->levelStyles['warn'] = 'yellow'; $this->logger->levelStyles['error'] = 'red'; }