ClientFactory::build()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2.0185

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 11
ccs 5
cts 6
cp 0.8333
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2.0185
1
<?php
2
3
namespace EasyHttp\SymfonyLayer\Factories;
4
5
use Symfony\Component\HttpClient\CurlHttpClient as SymfonyClient;
6
use Symfony\Component\HttpClient\MockHttpClient;
7
8
class ClientFactory
9
{
10 5
    public static function build($handler = null)
11
    {
12 5
        $instance = null;
13
14 5
        if ($handler) {
15 5
            $instance = new MockHttpClient($handler);
16
        } else {
17
            $instance = new SymfonyClient();
18
        }
19
20 5
        return $instance;
21
    }
22
}
23