Piwik\Tracker\Request::__construct PHP Method

__construct() public method

public __construct ( $params, boolean | string $tokenAuth = false )
$params
$tokenAuth boolean | string
    public function __construct($params, $tokenAuth = false)
    {
        if (!is_array($params)) {
            $params = array();
        }
        $this->params = $params;
        $this->rawParams = $params;
        $this->tokenAuth = $tokenAuth;
        $this->timestamp = time();
        $this->isEmptyRequest = empty($params);
        $this->customTimestampDoesNotRequireTokenauthWhenNewerThan = (int) TrackerConfig::getConfigValue('tracking_requests_require_authentication_when_custom_timestamp_newer_than');
        // When the 'url' and referrer url parameter are not given, we might be in the 'Simple Image Tracker' mode.
        // The URL can default to the Referrer, which will be in this case
        // the URL of the page containing the Simple Image beacon
        if (empty($this->params['urlref']) && empty($this->params['url']) && array_key_exists('HTTP_REFERER', $_SERVER)) {
            $url = $_SERVER['HTTP_REFERER'];
            if (!empty($url)) {
                $this->params['url'] = $url;
            }
        }
        // check for 4byte utf8 characters in url and replace them with �
        // @TODO Remove as soon as our database tables use utf8mb4 instead of utf8
        if (array_key_exists('url', $this->params) && preg_match('/[\\x{10000}-\\x{10FFFF}]/u', $this->params['url'])) {
            Common::printDebug("Unsupport character detected. Replacing with �");
            $this->params['url'] = preg_replace('/[\\x{10000}-\\x{10FFFF}]/u', "�", $this->params['url']);
        }
    }