view src/Kachkaev/JstmplBundle/Controller/JstmplController.php @ 1:f38015048f48 tip

Added GPL
author Daniel Wolff
date Sat, 13 Feb 2016 20:43:38 +0100
parents 493bcb69166c
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();
    }
}