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

SymfonyRequestAdapter::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 2
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
}