Ip\Application::prepareEnvironment PHP Method

prepareEnvironment() public method

public prepareEnvironment ( array $options = [] )
$options array
    public function prepareEnvironment($options = array())
    {
        if (empty($options['skipErrorHandler'])) {
            set_error_handler(array('Ip\\Internal\\ErrorHandler', 'ipErrorHandler'));
        }
        if (empty($options['skipError'])) {
            if (ipConfig()->showErrors()) {
                error_reporting(E_ALL | E_STRICT);
                ini_set('display_errors', '1');
            } else {
                ini_set('display_errors', '0');
            }
        }
        if (empty($options['skipSession'])) {
            if (session_id() == '' && !headers_sent()) {
                //if session hasn't been started yet
                session_name(ipConfig()->get('sessionName'));
                if (!ipConfig()->get('disableHttpOnlySetting')) {
                    ini_set('session.cookie_httponly', 1);
                }
                session_start();
            }
            $expireIn = ipConfig()->get('sessionMaxIdle', 1800);
            if (isset($_SESSION['module']['admin']['last_activity']) && time() - $_SESSION['module']['admin']['last_activity'] > $expireIn) {
                session_unset();
                session_destroy();
            }
            $_SESSION['module']['admin']['last_activity'] = time();
        }
        if (empty($options['skipEncoding'])) {
            mb_internal_encoding(ipConfig()->get('charset'));
        }
        if (empty($options['skipTimezone'])) {
            date_default_timezone_set(ipConfig()->get('timezone'));
            //PHP 5 requires timezone to be set.
        }
    }