1
1
<?php
2
2
3
+ declare (strict_types=1 );
4
+
5
+ /**
6
+ * This file is part of php-fast-forward/http.
7
+ *
8
+ * This source file is subject to the license bundled
9
+ * with this source code in the file LICENSE.
10
+ *
11
+ * @link https://github.com/php-fast-forward/http
12
+ * @copyright Copyright (c) 2025 Felipe Sayão Lobato Abreu <[email protected] >
13
+ * @license https://opensource.org/licenses/MIT MIT License
14
+ */
15
+
3
16
namespace FastForward \Http \ServiceProvider ;
4
17
5
18
use FastForward \Container \ServiceProvider \AggregateServiceProvider ;
6
19
use FastForward \Http \Client \ServiceProvider \HttpClientServiceProvider ;
7
20
use FastForward \Http \Message \Factory \ServiceProvider \HttpMessageFactoryServiceProvider ;
8
21
use Interop \Container \ServiceProviderInterface ;
9
22
23
+ /**
24
+ * Class HttpServiceProvider
25
+ *
26
+ * Aggregates and registers HTTP-related service providers. This class SHALL encapsulate the
27
+ * dependencies for HTTP client and message factory services within the container.
28
+ *
29
+ * It MUST implement the ServiceProviderInterface and MUST delegate factory and extension
30
+ * retrieval to the internal AggregateServiceProvider instance.
31
+ */
10
32
final class HttpServiceProvider implements ServiceProviderInterface
11
33
{
34
+ /**
35
+ * @var ServiceProviderInterface The aggregate service provider that includes all HTTP service providers.
36
+ */
12
37
private ServiceProviderInterface $ serviceProvider ;
13
38
39
+ /**
40
+ * Constructs the HttpServiceProvider.
41
+ *
42
+ * This constructor MUST initialize the internal service provider as an instance of
43
+ * AggregateServiceProvider composed of HTTP-related service providers.
44
+ */
14
45
public function __construct ()
15
46
{
16
47
$ this ->serviceProvider = new AggregateServiceProvider (
@@ -19,11 +50,25 @@ public function __construct()
19
50
);
20
51
}
21
52
53
+ /**
54
+ * Returns an array of factory callables provided by the aggregate service provider.
55
+ *
56
+ * This method MUST delegate the call to the internal AggregateServiceProvider.
57
+ *
58
+ * @return array<string, callable> A map of service identifiers to factory callables.
59
+ */
22
60
public function getFactories (): array
23
61
{
24
62
return $ this ->serviceProvider ->getFactories ();
25
63
}
26
64
65
+ /**
66
+ * Returns an array of service extension callables provided by the aggregate service provider.
67
+ *
68
+ * This method MUST delegate the call to the internal AggregateServiceProvider.
69
+ *
70
+ * @return array<string, callable> A map of service identifiers to extension callables.
71
+ */
27
72
public function getExtensions (): array
28
73
{
29
74
return $ this ->serviceProvider ->getExtensions ();
0 commit comments