Guzzle6Mock   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getMock() 0 7 1
1
<?php
2
3
namespace CanalTP\AbstractGuzzle\Mock;
4
5
use CanalTP\AbstractGuzzle\GuzzleFactory;
6
use GuzzleHttp\Handler\MockHandler;
7
use GuzzleHttp\HandlerStack;
8
9
class Guzzle6Mock
10
{
11
    /**
12
     * Guzzle6Mock .
13
     *
14
     * @param array $responseCollection new Response(200, ['X-Foo' => 'Bar']),
15
     * new Response(202, ['Content-Length' => 0]),
16
     * new RequestException("Error Communicating with Server", new Request('GET', 'test'))
17
     * @return \CanalTP\AbstractGuzzle\Guzzle
18
     */
19
    public function getMock(array $responseCollection)
20
    {
21
        $mock = new MockHandler($responseCollection);
22
        $handler = HandlerStack::create($mock);
23
24
        return GuzzleFactory::createClient('', ['handler' => $handler]);
25
    }
26
}
27