Completed
Push — master ( 0f4fe2...64d1c4 )
by Tobias
05:46 queued 03:44
created

History   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 24
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getLastResponse() 0 4 1
A addSuccess() 0 4 1
A addFailure() 0 3 1
1
<?php
2
3
/*
4
 * Copyright (C) 2013-2016 Mailgun
5
 *
6
 * This software may be modified and distributed under the terms
7
 * of the MIT license. See the LICENSE file for details.
8
 */
9
10
namespace Mailgun\HttpClient\Plugin;
11
12
use Http\Client\Common\Plugin\Journal;
13
use Http\Client\Exception;
14
use Psr\Http\Message\RequestInterface;
15
use Psr\Http\Message\ResponseInterface;
16
17
/**
18
 * A plugin to remember the last response.
19
 *
20
 * @author Tobias Nyholm <[email protected]>
21
 */
22
class History implements Journal
23
{
24
    /**
25
     * @var ResponseInterface
26
     */
27
    private $lastResponse;
28
29
    /**
30
     * @return ResponseInterface|null
31
     */
32
    public function getLastResponse()
33
    {
34
        return $this->lastResponse;
35
    }
36
37
    public function addSuccess(RequestInterface $request, ResponseInterface $response)
38
    {
39
        $this->lastResponse = $response;
40
    }
41
42
    public function addFailure(RequestInterface $request, Exception $exception)
43
    {
44
    }
45
}
46