Completed
Push — develop ( 2c75a2...3f95e8 )
by Adam
08:12
created

DiscoveryTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A discoverHttpClient() 0 4 1
A discoverMessageFactory() 0 4 1
1
<?php
2
3
namespace IBM\Watson\Common\Util;
4
5
use Http\Discovery\HttpClientDiscovery;
6
use Http\Discovery\MessageFactoryDiscovery;
7
8
/**
9
 * Utility trait for discovering required components.
10
 */
11
trait DiscoveryTrait
12
{
13
    /**
14
     * Discover configured HTTP client.
15
     *
16
     * @return \Http\Client\HttpClient
17
     */
18
    public function discoverHttpClient()
19
    {
20
        return HttpClientDiscovery::find();
21
    }
22
23
    /**
24
     * Discover configured message factory.
25
     *
26
     * @return \Http\Message\MessageFactory
27
     */
28
    public function discoverMessageFactory()
29
    {
30
        return MessageFactoryDiscovery::find();
31
    }
32
}
33