Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
HttpClientServiceProvider
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 register
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Engelsystem\Http;
6
7use Engelsystem\Container\ServiceProvider;
8use GuzzleHttp\Client as GuzzleClient;
9
10class HttpClientServiceProvider extends ServiceProvider
11{
12    public function register(): void
13    {
14        $this->app->when(GuzzleClient::class)
15            ->needs('$config')
16            ->give(
17                function () {
18                    return [
19                        // No exception on >= 400 responses
20                        'http_errors' => false,
21                        // Wait max n seconds for a response
22                        'timeout'     => 2.0,
23                    ];
24                }
25            );
26    }
27}