@@ -20,15 +20,14 @@ protected function assertNotSameObject($a, $b)
20
20
21
21
protected function buildUri ($ uri )
22
22
{
23
- $ factory = getenv ('URI_FACTORY ' );
24
-
25
- if (!empty ($ factory )) {
26
- $ factoryClass = new $ factory ();
27
- if (!$ factoryClass instanceof \Http \Message \UriFactory) {
28
- throw new \RuntimeException ('Environment variable "URI_FACTORY" must be a reference to a Http\Message\UriFactory ' );
23
+ if (!defined ('URI_FACTORY ' )) {
24
+ $ factoryClass = URI_FACTORY ;
25
+ $ factory = new $ factoryClass ();
26
+ if (!$ factory instanceof \Http \Message \UriFactory) {
27
+ throw new \RuntimeException ('Constant "URI_FACTORY" must be a reference to a Http\Message\UriFactory ' );
29
28
}
30
29
31
- return $ factoryClass ->createUri ($ uri );
30
+ return $ factory ->createUri ($ uri );
32
31
}
33
32
34
33
if (class_exists (GuzzleUri::class)) {
@@ -48,15 +47,14 @@ protected function buildUri($uri)
48
47
49
48
protected function buildStream ($ data )
50
49
{
51
- $ factory = getenv ('STREAM_FACTORY ' );
52
-
53
- if (!empty ($ factory )) {
54
- $ factoryClass = new $ factory ();
55
- if (!$ factoryClass instanceof \Http \Message \StreamFactory) {
56
- throw new \RuntimeException ('Environment variable "STREAM_FACTORY" must be a reference to a Http\Message\StreamFactory ' );
50
+ if (!defined ('STREAM_FACTORY ' )) {
51
+ $ factoryClass = STREAM_FACTORY ;
52
+ $ factory = new $ factoryClass ();
53
+ if (!$ factory instanceof \Http \Message \StreamFactory) {
54
+ throw new \RuntimeException ('Constant "STREAM_FACTORY" must be a reference to a Http\Message\StreamFactory ' );
57
55
}
58
56
59
- return $ factoryClass ->createStream ($ data );
57
+ return $ factory ->createStream ($ data );
60
58
}
61
59
62
60
if (class_exists (GuzzleStream::class)) {
0 commit comments