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\Application;
8use Engelsystem\Container\ServiceProvider;
9use GuzzleHttp\Client as GuzzleClient;
10
11class HttpClientServiceProvider extends ServiceProvider
12{
13    public function register(): void
14    {
15        $this->app->when(GuzzleClient::class)
16            ->needs('$config')
17            ->give(
18                function (Application $app) {
19                    return [
20                        // No exception on >= 400 responses
21                        'http_errors' => false,
22                        // Wait max n seconds for a response
23                        'timeout'     => $app->get('config')->get('guzzle_timeout'),
24                    ];
25                }
26            );
27    }
28}