Psr7Middlewares\Utils\FormTrait::insertIntoPostForms PHP Method

insertIntoPostForms() private method

Insert content into all POST forms.
private insertIntoPostForms ( Psr\Http\Message\ResponseInterface $response, callable $replace ) : Psr\Http\Message\ResponseInterface
$response Psr\Http\Message\ResponseInterface
$replace callable
return Psr\Http\Message\ResponseInterface
    private function insertIntoPostForms(ResponseInterface $response, callable $replace)
    {
        $html = (string) $response->getBody();
        $html = preg_replace_callback('/(<form\\s[^>]*method=["\']?POST["\']?[^>]*>)/i', $replace, $html, -1, $count);
        if (!empty($count)) {
            $body = self::createStream();
            $body->write($html);
            return $response->withBody($body);
        }
        return $response;
    }