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

PreProcessor::process()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 0
cts 8
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 2
crap 6
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