<commit_before><?php

namespace Core\Controller;

use Core\Auth\DBAuth;
use App;

abstract class Controller{
	
	protected $viewPath;
	protected $template;
	
	private function setTemplate($end = null){
		if($end == 'backend' || $end == 'frontend')
		    return $end;
	    elseif(in_array('admin', explode('/', $this->viewPath)) || in_array('user', explode('/', $this->viewPath)))
			return 'backend';
		else
			return 'frontend';
	}
	
	protected function render($view, $variables = [], $end = null){
		ob_start();
		extract($variables);
		require($this->viewPath . $view . '.php');
		$content = ob_get_clean();
	    require(ROOT . "/app/Views/templates/{$this->template}-{$this->setTemplate($end)}.php");
	}
	
	public function redirect($location = '/', $page = 'index', $get = null){
		header("Location: {$location}" . (($get != null) ? '?' . (($get == 1) ? 'do' : $get) . '=' . $page : ''));
	}
	
}<commit_msg>Update Controller.php<commit_after><?php

namespace Core\Controller;

use Core\Auth\DBAuth;
use App;

abstract class Controller{

	protected $viewPath;
	protected $template;

	private function setFace($face = 'backend'){
		if($face == 'backend' || $face == 'frontend') return $face;
		else return 'backend';
	}

	protected function render($view, $variables = [], $face = null){
		ob_start();
		extract($variables);
		require($this->viewPath . $view . '.php');
		$content = ob_get_clean();
		require(ROOT . "/app/Views/templates/{$this->setFace($face)}/{$this->template}.php");
	}

	public function redirect($location = '/', $params = null){
		$params = ($params != null) ? '?' . $params : null;
		header("Location: {$location}{$params}");
		exit;
	}

	public function action($class, $params = null){
		if(method_exists($class)){
			$restriction_name = strtolower(preg_replace('/\B([A-Z])/', '_$1', $class));
			$this->isRestricted($class);
			$this->$class($params);
		}
	}

}
{'fraction_non_alphanumeric': 0.21155885471898198, 'fraction_numerical': 0.0010604453870625664, 'mean_word_length': 4.3456090651558075, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '1053133', 'n_tokens_mistral': 668, 'n_tokens_neox': 621, 'n_words': 134}