Passed
Push — master ( e64db9...9024ac )
by Darío
02:56
created

ClientFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 8
dl 0
loc 14
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A build() 0 12 2
1
<?php
2
3
namespace EasyHttp\GuzzleLayer\Factories;
4
5
use GuzzleHttp\Client;
6
use GuzzleHttp\HandlerStack;
7
8
class ClientFactory
9
{
10 6
    public static function build($handler = null)
11
    {
12 6
        $instance = null;
13
14 6
        if ($handler) {
15 5
            $handler  = HandlerStack::create($handler);
16 5
            $instance = new Client(['handler' => $handler]);
17
        } else {
18 1
            $instance = new Client();
19
        }
20
21 6
        return $instance;
22
    }
23
}
24