Conditions | 3 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
44 | protected function getIPAddress( \Psr\Http\Message\ServerRequestInterface $request ) : ?string |
||
45 | { |
||
46 | $server = $request->getServerParams(); |
||
47 | $flags = FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6; |
||
48 | |||
49 | if( isset( $server['REMOTE_ADDR'] ) |
||
50 | && ( $ip = filter_var( $server['REMOTE_ADDR'], FILTER_VALIDATE_IP, $flags ) ) !== false |
||
51 | ) { |
||
52 | return $ip; |
||
53 | } |
||
54 | |||
55 | return null; |
||
56 | } |
||
58 |