@@ -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