@@ -26,7 +26,7 @@ class Statistics
26
26
27
27
private float $ redirectTime ;
28
28
29
- private string $ redirectEndpoint ;
29
+ private ? string $ redirectEndpoint = null ;
30
30
31
31
public function populateFromCurlResult (\CurlHandle |false $ curl ): self
32
32
{
@@ -40,70 +40,49 @@ public function populateFromCurlResult(\CurlHandle|false $curl): self
40
40
$ this ->startTransferTime = curl_getinfo ($ curl , CURLINFO_STARTTRANSFER_TIME );
41
41
$ this ->redirectCount = curl_getinfo ($ curl , CURLINFO_REDIRECT_COUNT );
42
42
$ 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
+ }
44
47
return $ this ;
45
48
}
46
49
47
- /**
48
- * @return float
49
- */
50
50
public function getTotalTime (): float
51
51
{
52
52
return $ this ->totalTime ;
53
53
}
54
54
55
- /**
56
- * @return float
57
- */
58
55
public function getHostLookupTime (): float
59
56
{
60
57
return $ this ->hostLookupTime ;
61
58
}
62
59
63
- /**
64
- * @return float
65
- */
66
60
public function getConnectionEstablishTime (): float
67
61
{
68
62
return $ this ->connectionEstablishTime ;
69
63
}
70
64
71
- /**
72
- * @return float
73
- */
74
65
public function getPreTransferTime (): float
75
66
{
76
67
return $ this ->preTransferTime ;
77
68
}
78
69
79
- /**
80
- * @return float
81
- */
82
70
public function getStartTransferTime (): float
83
71
{
84
72
return $ this ->startTransferTime ;
85
73
}
86
74
87
- /**
88
- * @return int
89
- */
90
75
public function getRedirectCount (): int
91
76
{
92
77
return $ this ->redirectCount ;
93
78
}
94
79
95
- /**
96
- * @return float
97
- */
98
80
public function getRedirectTime (): float
99
81
{
100
82
return $ this ->redirectTime ;
101
83
}
102
84
103
- /**
104
- * @return string
105
- */
106
- public function getRedirectEndpoint (): string
85
+ public function getRedirectEndpoint (): ?string
107
86
{
108
87
return $ this ->redirectEndpoint ;
109
88
}
0 commit comments