Skip to content

Commit c131463

Browse files
committed
fix issues with statistics class property redirect url
1 parent 20bc9ef commit c131463

File tree

3 files changed

+14
-30
lines changed

3 files changed

+14
-30
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Find out more at the [„PSR-7 is imminent, and here's my issues with it“](htt
2626
```{json}
2727
{
2828
"require": {
29-
"chroma-x/basic-http-client": "~3.0"
29+
"chroma-x/basic-http-client": "~4.0"
3030
}
3131
}
3232
```

composer.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@
1010
"Basic Auth",
1111
"Client Certificate Auth"
1212
],
13-
"homepage": "http://chroma-x.de/",
13+
"homepage": "https://chroma-x.de/",
1414
"license": "MIT",
1515
"authors": [
1616
{
1717
"name": "Martin Brecht-Precht",
1818
"email": "[email protected]",
19-
"homepage": "http://chroma-x.de"
19+
"homepage": "https://chroma-x.de"
20+
},
21+
{
22+
"name": "Andrius Baliutis",
23+
"email": "[email protected]",
24+
"homepage": "https://chroma-x.de"
2025
}
2126
],
2227
"autoload": {

src/Response/Statistics/Statistics.php

+6-27
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Statistics
2626

2727
private float $redirectTime;
2828

29-
private string $redirectEndpoint;
29+
private ?string $redirectEndpoint = null;
3030

3131
public function populateFromCurlResult(\CurlHandle|false $curl): self
3232
{
@@ -40,70 +40,49 @@ public function populateFromCurlResult(\CurlHandle|false $curl): self
4040
$this->startTransferTime = curl_getinfo($curl, CURLINFO_STARTTRANSFER_TIME);
4141
$this->redirectCount = curl_getinfo($curl, CURLINFO_REDIRECT_COUNT);
4242
$this->redirectTime = curl_getinfo($curl, CURLINFO_REDIRECT_TIME);
43-
$this->redirectEndpoint = curl_getinfo($curl, CURLINFO_REDIRECT_URL);
43+
$redirectUrl = curl_getinfo($curl, CURLINFO_REDIRECT_URL);
44+
if ($redirectUrl !== false) {
45+
$this->redirectEndpoint = $redirectUrl;
46+
}
4447
return $this;
4548
}
4649

47-
/**
48-
* @return float
49-
*/
5050
public function getTotalTime(): float
5151
{
5252
return $this->totalTime;
5353
}
5454

55-
/**
56-
* @return float
57-
*/
5855
public function getHostLookupTime(): float
5956
{
6057
return $this->hostLookupTime;
6158
}
6259

63-
/**
64-
* @return float
65-
*/
6660
public function getConnectionEstablishTime(): float
6761
{
6862
return $this->connectionEstablishTime;
6963
}
7064

71-
/**
72-
* @return float
73-
*/
7465
public function getPreTransferTime(): float
7566
{
7667
return $this->preTransferTime;
7768
}
7869

79-
/**
80-
* @return float
81-
*/
8270
public function getStartTransferTime(): float
8371
{
8472
return $this->startTransferTime;
8573
}
8674

87-
/**
88-
* @return int
89-
*/
9075
public function getRedirectCount(): int
9176
{
9277
return $this->redirectCount;
9378
}
9479

95-
/**
96-
* @return float
97-
*/
9880
public function getRedirectTime(): float
9981
{
10082
return $this->redirectTime;
10183
}
10284

103-
/**
104-
* @return string
105-
*/
106-
public function getRedirectEndpoint(): string
85+
public function getRedirectEndpoint(): ?string
10786
{
10887
return $this->redirectEndpoint;
10988
}

0 commit comments

Comments
 (0)