History   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addStats() 0 3 1
A mergeInfo() 0 9 2
1
<?php
2
3
namespace Sludio\HelperBundle\Guzzle\GuzzleHttp\History;
4
5
use GuzzleHttp\TransferStats;
6
use Psr\Http\Message\RequestInterface;
7
8
class History extends \SplObjectStorage
9
{
10
    public function addStats(TransferStats $stats)
11
    {
12
        $this->mergeInfo($stats->getRequest(), ['info' => $stats->getHandlerStats()]);
13
    }
14
15
    public function mergeInfo(RequestInterface $request, array $info)
16
    {
17
        $info = array_merge([
18
            'response' => null,
19
            'error' => null,
20
            'info' => null,
21
        ], array_filter($this->contains($request) ? $this[$request] : []), array_filter($info));
22
23
        $this->attach($request, $info);
24
    }
25
}
26