<commit_before><?php

declare(strict_types=1);

namespace Shlinkio\Shlink;

use Laminas\Stratigility\Middleware\ErrorHandler;
use Mezzio\Helper;
use Mezzio\ProblemDetails;
use Mezzio\Router;
use PhpMiddleware\RequestId\RequestIdMiddleware;

return [

    'middleware_pipeline' => [
        'error-handler' => [
            'middleware' => [
                Helper\ContentLengthMiddleware::class,
                ErrorHandler::class,
            ],
        ],
        'error-handler-rest' => [
            'path' => '/rest',
            'middleware' => [
                Rest\Middleware\CrossDomainMiddleware::class,
                RequestIdMiddleware::class,
                ProblemDetails\ProblemDetailsMiddleware::class,
            ],
        ],

        'pre-routing' => [
            'middleware' => [
                Common\Middleware\CloseDbConnectionMiddleware::class,
            ],
        ],<commit_msg>Fixed issue with swoole 4.6.3<commit_after><?php

declare(strict_types=1);

namespace Shlinkio\Shlink;

use Laminas\Stratigility\Middleware\ErrorHandler;
use Mezzio\Helper;
use Mezzio\ProblemDetails;
use Mezzio\Router;
use PhpMiddleware\RequestId\RequestIdMiddleware;

use function extension_loaded;

return [

    'middleware_pipeline' => [
        'error-handler' => [
            'middleware' => [
                // For some reason, with swoole 4.6.3, piping this middleware makes requests to have incomplete body or
                // never finish loading. Disabling it for swoole fixes it as it already calculates the header on itself
                ...extension_loaded('swoole') ? [] : [Helper\ContentLengthMiddleware::class],
                ErrorHandler::class,
            ],
        ],
        'error-handler-rest' => [
            'path' => '/rest',
            'middleware' => [
                Rest\Middleware\CrossDomainMiddleware::class,
                RequestIdMiddleware::class,
                ProblemDetails\ProblemDetailsMiddleware::class,
            ],
        ],

        'pre-routing' => [
            'middleware' => [
                Common\Middleware\CloseDbConnectionMiddleware::class,
            ],
        ],
{'fraction_non_alphanumeric': 0.11172925359295317, 'fraction_numerical': 0.0037088548910523874, 'mean_word_length': 2.03943661971831, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '2131952', 'n_tokens_mistral': 590, 'n_tokens_neox': 585, 'n_words': 101}