<commit_before><?php

/*
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view
 * the LICENSE file that was distributed with this source code.
 */

namespace Alcohol\PasteBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\RouterInterface;

class IndexController
{
    /** @var RouterInterface */
    protected $router;

    /**
     * @param RouterInterface $router
     */
    public function __construct(RouterInterface $router)
    {
        $this->router = $router;
    }

    /**
     * @param Request $request
     * @return Response
     */
    public function __invoke(Request $request)
    {
        $href = $this->router->generate('paste.create');
        $host = $this->router->generate('paste.create', [], RouterInterface::ABSOLUTE_URL);
        $form = <<<FORM
data:text/html,<form action="$href" method="POST" accept-charset="UTF-8">
<textarea name="paste" cols="100" rows="30"></textarea>
<br><button type="submit">paste</button></form>
FORM;
        $body = <<<BODY
<style>body { padding: 2em; }</style>
<pre>
DESCRIPTION
    paste: command line pastebin.

USING
    &lt;command&gt; | curl --data-binary '@-' $host

ALTERNATIVELY
    use <a href='$form'>this form</a> to paste from a browser

SOURCE
    <a href='https://github.com/alcohol/sf-minimal-demo/'>github.com/alcohol</a>
</pre>
BODY;

        $response = new Response($body, 200);
        $response
            ->setPublic()
            ->setETag(md5($response->getContent()))
            ->setTtl(60 * 60)
            ->setClientTtl(60 * 10)
        ;

        if (!$request->isNoCache()) {
            $response->isNotModified($request);
        }

        return $response;
    }
}
<commit_msg>should be the same uri<commit_after><?php

/*
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view
 * the LICENSE file that was distributed with this source code.
 */

namespace Alcohol\PasteBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\RouterInterface;

class IndexController
{
    /** @var RouterInterface */
    protected $router;

    /**
     * @param RouterInterface $router
     */
    public function __construct(RouterInterface $router)
    {
        $this->router = $router;
    }

    /**
     * @param Request $request
     * @return Response
     */
    public function __invoke(Request $request)
    {
        $href = $this->router->generate('paste.create', [], RouterInterface::ABSOLUTE_URL);
        $form = <<<FORM
data:text/html,<form action="$href" method="POST" accept-charset="UTF-8">
<textarea name="paste" cols="100" rows="30"></textarea>
<br><button type="submit">paste</button></form>
FORM;
        $body = <<<BODY
<style>body { padding: 2em; }</style>
<pre>
DESCRIPTION
    paste: command line pastebin.

USING
    &lt;command&gt; | curl --data-binary '@-' $href

ALTERNATIVELY
    use <a href='$form'>this form</a> to paste from a browser

SOURCE
    <a href='https://github.com/alcohol/sf-minimal-demo/'>github.com/alcohol</a>
</pre>
BODY;

        $response = new Response($body, 200);
        $response
            ->setPublic()
            ->setETag(md5($response->getContent()))
            ->setTtl(60 * 60)
            ->setClientTtl(60 * 10)
        ;

        if (!$request->isNoCache()) {
            $response->isNotModified($request);
        }

        return $response;
    }
}

{'fraction_non_alphanumeric': 0.15391108610016882, 'fraction_numerical': 0.010692177827799663, 'mean_word_length': 2.8852459016393444, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 61, 'https://': 2, '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': '4104249', 'n_tokens_mistral': 1142, 'n_tokens_neox': 1084, 'n_words': 244}