@@ -13,16 +13,16 @@
Loading
13 13
     *
14 14
     * Defaults to indefinitely.
15 15
     *
16 -
     * @var float
16 +
     * @var float|null
17 17
     */
18 -
    private $connectTimeout = \INF;
18 +
    private $connectTimeout;
19 19
20 20
    /**
21 21
     * The amount of seconds to wait while reading a streamed body.
22 22
     *
23 23
     * Defaults to the value of the default_socket_timeout PHP ini setting.
24 24
     *
25 -
     * @var float
25 +
     * @var float|null
26 26
     */
27 27
    private $readTimeout;
28 28
@@ -31,9 +31,9 @@
Loading
31 31
     *
32 32
     * Defaults to indefinitely.
33 33
     *
34 -
     * @var float
34 +
     * @var float|null
35 35
     */
36 -
    private $timeout = \INF;
36 +
    private $timeout;
37 37
38 38
    /**
39 39
     * The proxy that all requests should be passed through.
@@ -44,7 +44,6 @@
Loading
44 44
45 45
    private function __construct()
46 46
    {
47 -
        $this->readTimeout = ((float) \ini_get('default_socket_timeout')) ?: \INF;
48 47
    }
49 48
50 49
    public static function default(): self
@@ -57,7 +56,7 @@
Loading
57 56
     *
58 57
     * Defaults to indefinitely.
59 58
     */
60 -
    public function connectTimeout(): float
59 +
    public function connectTimeout(): ?float
61 60
    {
62 61
        return $this->connectTimeout;
63 62
    }
@@ -82,7 +81,7 @@
Loading
82 81
     *
83 82
     * Defaults to the value of the default_socket_timeout PHP ini setting.
84 83
     */
85 -
    public function readTimeout(): float
84 +
    public function readTimeout(): ?float
86 85
    {
87 86
        return $this->readTimeout;
88 87
    }
@@ -107,7 +106,7 @@
Loading
107 106
     *
108 107
     * Defaults to indefinitely.
109 108
     */
110 -
    public function timeout(): float
109 +
    public function timeout(): ?float
111 110
    {
112 111
        return $this->timeout;
113 112
    }

@@ -574,9 +574,17 @@
Loading
574 574
            $config[RequestOptions::PROXY] = $proxy;
575 575
        }
576 576
577 -
        $config[RequestOptions::CONNECT_TIMEOUT] = $this->httpClientOptions->connectTimeout();
578 -
        $config[RequestOptions::READ_TIMEOUT] = $this->httpClientOptions->readTimeout();
579 -
        $config[RequestOptions::TIMEOUT] = $this->httpClientOptions->timeout();
577 +
        if ($connectTimeout = $this->httpClientOptions->connectTimeout()) {
578 +
            $config[RequestOptions::CONNECT_TIMEOUT] = $connectTimeout;
579 +
        }
580 +
581 +
        if ($readTimeout = $this->httpClientOptions->readTimeout()) {
582 +
            $config[RequestOptions::READ_TIMEOUT] = $readTimeout;
583 +
        }
584 +
585 +
        if ($totalTimeout = $this->httpClientOptions->timeout()) {
586 +
            $config[RequestOptions::TIMEOUT] = $totalTimeout;
587 +
        }
580 588
581 589
        $handler = $config['handler'] ?? null;
582 590
Files Complexity Coverage
src/Firebase 1,405 95.84%
Project Totals (147 files) 1405 95.84%
1
comment:
2
  layout: "reach,diff"
3

4
coverage:
5
  status:
6
    project:
7
      default:
8
        informational: true
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading