<commit_before><?php 

namespace Controllers;

use \Core\Controller;
use \Core\App;

class PostController extends \Core\Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->post = App::get('\Models\Post');
        $this->user = App::get('\Models\User');
    }

    public function index()
    {
        $posts = $this->post->all();

        if($this->isAjax())
        {
            $this->view->json(compact('posts'));
        }
        else
        {
            $this->view->render('post/index', compact('posts'));
        }
    }

    public function show($id)
    {
        $post = $this->post->find($id);

        if($this->isAjax())
        {
            $this->view->json(compact('post'));
        }
        else
        {
            $this->view->render('post/show', compact('post'));
        }
    }

}<commit_msg>404 if post not found<commit_after><?php 

namespace Controllers;

use \Core\Controller;
use \Core\App;

class PostController extends \Core\Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->post = App::get('\Models\Post');
        $this->user = App::get('\Models\User');
    }

    public function index()
    {
        $posts = $this->post->all();

        if($this->isAjax())
        {
            $this->view->json(compact('posts'));
        }
        else
        {
            $this->view->render('post/index', compact('posts'));
        }
    }

    public function show($id)
    {
        $post = $this->post->find($id);

        if(!$post)
        {
            $this->notFound();
        }

        if($this->isAjax())
        {
            $this->view->json(compact('post'));
        }
        else
        {
            $this->view->render('post/show', compact('post'));
        }
    }

}
{'fraction_non_alphanumeric': 0.18141836173721826, 'fraction_numerical': 0.0016492578339747114, 'mean_word_length': 1.6883308714918759, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 36, 'https://': 0, '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': '4986433', 'n_tokens_mistral': 557, 'n_tokens_neox': 546, 'n_words': 84}