Request   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 3
c 2
b 1
f 0
lcom 1
cbo 1
dl 0
loc 33
ccs 9
cts 9
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getBody() 0 8 2
1
<?php
2
3
namespace Raidros\Storer;
4
5
class Request
6
{
7
    protected $request;
8
    protected $transformer;
9
10
    /**
11
     * Configure a api request.
12
     *
13
     * @param array            $request
14
     * @param Transformer|null $transformer
15
     */
16 15
    public function __construct(array $request, Transformer $transformer = null)
17
    {
18 15
        $this->request = $request;
19 15
        $this->transformer = $transformer;
20 15
    }
21
22
    /**
23
     * return the transformed request body.
24
     *
25
     * @param string $keyChain
26
     *
27
     * @return array
28
     */
29 15
    public function getBody($keyChain)
30
    {
31 15
        if ($this->transformer) {
32 3
            $this->request[$keyChain] = $this->transformer->transformData($this->request[$keyChain]);
33 3
        }
34
35 15
        return $this->request;
36
    }
37
}
38