<?php

namespace App\Controller;


use App\Entity\Snippet;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

class DemoController extends AbstractController
{
    /**
     * @Route("/highlight", name="demo_highlight", methods={"POST"})
     */
    public function highlightAction(Request $request)
    {
        $snippet = new Snippet();
        $snippet->setLanguage($request->get('language'));
        $snippet->setCode($request->get('source'));

        return $this->forward(sprintf('%s::showAction', SnippetController::class), ['snippet' => $snippet]);
    }

}
