Skip to content

Commit beb08ac

Browse files
Merge pull request #56 from janyksteenbeek/main
refactor: update parameters to allow null values
2 parents 5b8d535 + 6cc9f54 commit beb08ac

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Matomo.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@ class Matomo
109109
public function __construct(
110110
string $site,
111111
string $token,
112-
int $siteId = null,
112+
?int $siteId = null,
113113
string $format = self::FORMAT_JSON,
114114
string $period = self::PERIOD_DAY,
115115
string $date = self::DATE_YESTERDAY,
116116
string $rangeStart = '',
117-
string $rangeEnd = null,
118-
ClientInterface $client = null,
117+
?string $rangeEnd = null,
118+
?ClientInterface $client = null,
119119
) {
120120
$this->_site = $site;
121121
$this->_token = $token;
@@ -288,7 +288,7 @@ public function getDate(): string
288288
*
289289
* @return $this
290290
*/
291-
public function setDate(string $date = null): Matomo
291+
public function setDate(?string $date = null): Matomo
292292
{
293293
$this->_date = $date;
294294
$this->_rangeStart = null;
@@ -349,7 +349,7 @@ public function getRange(): string
349349
*
350350
* @return $this
351351
*/
352-
public function setRange(string $rangeStart = null, string $rangeEnd = null): Matomo
352+
public function setRange(?string $rangeStart = null, ?string $rangeEnd = null): Matomo
353353
{
354354
$this->_date = '';
355355
$this->_rangeStart = $rangeStart;
@@ -465,7 +465,7 @@ private function _request(
465465
string $method,
466466
array $params = [],
467467
array $optional = [],
468-
string $overrideFormat = null
468+
?string $overrideFormat = null
469469
): mixed {
470470
$url = $this->_parseUrl($method, $params + $optional);
471471
if ($url === '') {
@@ -599,7 +599,7 @@ private function _isValidResponse(string $contents): bool|string
599599
* @return mixed Either the parsed response body object (parsed from json) or the raw response object.
600600
* @throws JsonException
601601
*/
602-
private function _parseResponse(string $contents, string $overrideFormat = null): mixed
602+
private function _parseResponse(string $contents, ?string $overrideFormat = null): mixed
603603
{
604604
$format = $overrideFormat ?? $this->_format;
605605

0 commit comments

Comments
 (0)