<commit_before><?php

use Psr7Middlewares\Middleware;

class FirewallTest extends Base
{
    public function ipsProvider()
    {
        return [
            [
                [
                    'Client-Ip' => 'unknow,123.456.789.10,172.16.17.32',
                    'X-Forwarded' => '172.16.17.32',
                ],
                [],
                [],
                403,
            ], [
                [
                    'Client-Ip' => 'unknow,123.456.789.10,172.16.17.32',
                    'X-Forwarded' => '172.16.17.32',
                ],
                ['172.16.17.32'],
                [],
                200,
            ], [
                [
                    'Client-Ip' => 'unknow,123.456.789.10,172.16.58.3',
                    'X-Forwarded' => '172.16.17.32',
                ],
                ['172.16.58.3'],
                ['172.16.17.32'],
                403,
            ], [
                [
                    'Client-Ip' => '192.168.3.11,172.16.58.3',
                    'X-Forwarded' => '172.16.17.32',
                ],
                ['123.0.0.*'],
                [],
                200,
            ], [
                [
                    'Client-Ip' => '192.168.3.11,172.16.58.3',
                    'X-Forwarded' => '172.16.17.32',
                ],
                ['123.0.0.*'],
                ['172.16.17.32'],
                403,
            ],
        ];
    }

    /**
     * @dataProvider ipsProvider
     */
    public function testFirewall(array $headers, array $trusted, array $untrusted, $status)
    {
        $response = $this->execute(
            [
                (Middleware::ClientIp())->headers(),
                Middleware::Firewall()
                    ->trusted($trusted)
                    ->untrusted($untrusted),
            ],
            '',
            $headers<commit_msg>fixed code typo<commit_after><?php

use Psr7Middlewares\Middleware;

class FirewallTest extends Base
{
    public function ipsProvider()
    {
        return [
            [
                [
                    'Client-Ip' => 'unknow,123.456.789.10,172.16.17.32',
                    'X-Forwarded' => '172.16.17.32',
                ],
                [],
                [],
                403,
            ], [
                [
                    'Client-Ip' => 'unknow,123.456.789.10,172.16.17.32',
                    'X-Forwarded' => '172.16.17.32',
                ],
                ['172.16.17.32'],
                [],
                200,
            ], [
                [
                    'Client-Ip' => 'unknow,123.456.789.10,172.16.58.3',
                    'X-Forwarded' => '172.16.17.32',
                ],
                ['172.16.58.3'],
                ['172.16.17.32'],
                403,
            ], [
                [
                    'Client-Ip' => '192.168.3.11,172.16.58.3',
                    'X-Forwarded' => '172.16.17.32',
                ],
                ['123.0.0.*'],
                [],
                200,
            ], [
                [
                    'Client-Ip' => '192.168.3.11,172.16.58.3',
                    'X-Forwarded' => '172.16.17.32',
                ],
                ['123.0.0.*'],
                ['172.16.17.32'],
                403,
            ],
        ];
    }

    /**
     * @dataProvider ipsProvider
     */
    public function testFirewall(array $headers, array $trusted, array $untrusted, $status)
    {
        $response = $this->execute(
            [
                Middleware::ClientIp()->headers(),
                Middleware::Firewall()
                    ->trusted($trusted)
                    ->untrusted($untrusted),
            ],
            '',
            $headers
{'fraction_non_alphanumeric': 0.16008537886872998, 'fraction_numerical': 0.10618996798292422, 'mean_word_length': 0.8015377222489188, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 32, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1644067', 'n_tokens_mistral': 1357, 'n_tokens_neox': 1079, 'n_words': 121}