<commit_before><?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
 * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace KapNg\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;

class TemplateController extends AbstractActionController
{
    public function templateAction()
    {
        $model = new ViewModel();
        $model->setTemplate('ng-template/' . $this->params()->fromRoute('template'));
        $model->setTerminal(true);//disable layout
        
        return $model;
    }
    
}<commit_msg>404 when template is not found<commit_after><?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
 * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace KapNg\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;

class TemplateController extends AbstractActionController
{
    public function templateAction()
    {
        $template = $this->params()->fromRoute('template');
        $resolver = $this->getServiceLocator()->get('ViewResolver');
        if(!$resolver->resolve($template)) {
            return $this->notFoundAction();
        }
        
        $model = new ViewModel();
        $model->setTemplate('ng-template/' . $template);
        $model->setTerminal(true);//disable layout
        
        return $model;
    }
    
}
{'fraction_non_alphanumeric': 0.1352253756260434, 'fraction_numerical': 0.010573177518085699, 'mean_word_length': 3.2606635071090047, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2756095', 'n_tokens_mistral': 527, 'n_tokens_neox': 495, 'n_words': 106}