Bolt\Provider\TranslationServiceProvider::setDefaultTimezone PHP Method

setDefaultTimezone() protected method

protected setDefaultTimezone ( Silex\Application $app )
$app Silex\Application
    protected function setDefaultTimezone(Application $app)
    {
        if (($timezone = $app['config']->get('general/timezone')) !== null) {
            date_default_timezone_set($timezone);
            return;
        }
        // PHP 7.0+ doesn't emit warning for no timezone set.
        if (PHP_MAJOR_VERSION > 5) {
            return;
        }
        // Run check to see if a default timezone has been set
        $hasDefault = true;
        set_error_handler(function () use(&$hasDefault) {
            $hasDefault = false;
        });
        date_default_timezone_get();
        restore_error_handler();
        // If no default, set to UTC to prevent default not defined warnings
        if (!$hasDefault) {
            date_default_timezone_set('UTC');
        }
    }