Skip to content

Commit

Permalink
Fix handling of some attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
sgiehl committed Oct 8, 2024
1 parent b7a7769 commit 40840c3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions MatomoTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class MatomoTracker

public $hasCookies = false;

public $token_auth = false;
public $token_auth = null;

public $userAgent = false;

Expand Down Expand Up @@ -159,7 +159,7 @@ class MatomoTracker
public $configReferralCookieTimeout = 15768000; // 6 months

// Visitor Ids in order
public $userId = false;
public $userId = null;

public $forcedVisitorId = false;

Expand Down Expand Up @@ -1571,11 +1571,11 @@ public function setIp(string $ip)
*
* A User ID can be a username, UUID or an email address, or any number or string that uniquely identifies a user or client.
*
* @param string $userId Any user ID string (eg. email address, ID, username). Must be non empty. Set to false to de-assign a user id previously set.
* @param string|null $userId Any user ID string (eg. email address, ID, username). Must be non empty. Set to null to de-assign a user id previously set.
* @return $this
* @throws Exception
*/
public function setUserId(string $userId)
public function setUserId(?string $userId)
{
if ($userId === '') {
throw new Exception("User ID cannot be empty.");
Expand Down Expand Up @@ -1674,9 +1674,9 @@ public function getIp()
* Returns the User ID string, which may have been set via:
* $v->setUserId('[email protected]');
*
* @return bool
* @return string|null
*/
public function getUserId()
public function getUserId(): ?string
{
return $this->userId;
}
Expand Down Expand Up @@ -1743,10 +1743,10 @@ public function getAttributionInfo()
* - force the visitor IP
* - force the date & time of the tracking requests rather than track for the current datetime
*
* @param string $token_auth token_auth 32 chars token_auth string
* @param string|null $token_auth token_auth 32 chars token_auth string
* @return $this
*/
public function setTokenAuth(string $token_auth)
public function setTokenAuth(?string $token_auth)
{
$this->token_auth = $token_auth;

Expand Down Expand Up @@ -2052,7 +2052,7 @@ protected function prepareStreamOptions(string $method, $data, bool $forcePostUr
/**
* @ignore
*/
protected function sendRequest(string $url, string $method = 'GET', $data = null, bool $force = false): string
protected function sendRequest(string $url, string $method = 'GET', $data = null, bool $force = false)
{
self::$DEBUG_LAST_REQUESTED_URL = $url;

Expand Down Expand Up @@ -2114,7 +2114,7 @@ protected function sendRequest(string $url, string $method = 'GET', $data = null
curl_setopt_array($ch, $options);
ob_start();
$response = @curl_exec($ch);

try {
$header = '';

Expand Down

0 comments on commit 40840c3

Please sign in to comment.