Passed
Pull Request — master (#27)
by
unknown
11:39
created

SymfonyRequestAdapter::getHeaders()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 7
rs 10
1
<?php
2
3
namespace Vectorface\Whip\Request;
4
5
use Symfony\Component\HttpFoundation\Request;
6
7
class SymfonyRequestAdapter implements RequestAdapter
8
{
9
    public function __construct(private Request $request)
10
    {
11
    }
12
    /**
13
     * @inheritDoc
14
     */
15
    public function getRemoteAddr(): ?string
16
    {
17
        return $this->request->getClientIp();
18
    }
19
20
    /**
21
     * @inheritDoc
22
     */
23
    public function getHeaders(): array
24
    {
25
        $headers = [];
26
        foreach ($this->request->headers->all() as $key => $value) {
27
            $headers[$key] = implode(',', $value);
28
        }
29
        return $headers;
30
    }
31
}