ClientFactory::build()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 12
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 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