view src/Kachkaev/JstmplBundle/Controller/JstmplController.php @ 0:493bcb69166c

added public content
author Daniel Wolff
date Tue, 09 Feb 2016 20:54:02 +0100
parents
children
line wrap: on
line source
<?php

namespace Kachkaev\JstmplBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;

class JstmplController extends Controller
{
    public function indexAction($name)
    {
        foreach ($this->container->getParameter('jstmpl.source.patterns') as $v) {
            try {
                $response = $this->render(str_replace('{name}',$name, $v));
                return $response;
            } catch (\InvalidArgumentException $e) {
            }
        }

        throw new NotFoundHttpException();
    }
}