Completed
Pull Request — develop (#605)
by
unknown
05:24
created

PreProcessor   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 21
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 11 2
1
<?php
2
/**
3
 * Schema Class for output data.
4
 */
5
namespace Graviton\ProxyApiBundle\Processor;
6
7
use Graviton\ProxyApiBundle\Helper\HttpHelper;
8
use Symfony\Component\HttpFoundation\Request;
9
10
/**
11
 * Before Proxy Request process and prepare data for orequest
12
 *
13
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
14
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
15
 * @link     http://swisscom.ch
16
 */
17
class PreProcessor implements PreProcessorInterface
18
{
19
    /**
20
     * Filter or change values of incoming request to be processed
21
     *
22
     * @param Request    $originalRequest Incoming current request
23
     * @param HttpHelper $httpHelper      Building the new request
24
     * @return HttpHelper
25
     */
26
    public function process(Request $originalRequest, HttpHelper $httpHelper)
27
    {
28
        $httpHelper->setMethod($originalRequest->getMethod());
29
30
        // Query Params
31
        foreach ($originalRequest->query as $name => $value) {
32
            $httpHelper->addQueryParams($name, $value);
33
        }
34
35
        return $httpHelper;
36
    }
37
}
38