<commit_before><?php namespace Anvil;

use Anvil\Auth\AuthManager as Auth;
use Anvil\Routing\Inspector\Inspector;

use Illuminate\Http\Request;
use Illuminate\Routing\Router;
use Illuminate\Foundation\Application as IlluminateApplication;

class Application extends IlluminateApplication {

	/**
	 * The route detected from the requested URI.
	 *
	 * @var Anvil\Routing\Inspector\Route
	 */
	protected $route;

	/**
	 * Create a route to the detected current controller.
	 *
	 * @param  Illuminate\Http\Request    $request
	 * @param  Anvil\Routing\Inspector    $inspector
	 * @param  Illuminate\Routing\Router  $router
	 * @return void
	 */
	public function start(Request $request, Inspector $inspector, Router $router)
	{
		// Let's pass the request to the inspector. The inspector
		// will determine which route and controller that should
		// respond to the current request.
		$this->route = $inspector->inspect($request);

		// If the route is null, then the inspector could not find
		// a matching route and controller. Let's just abort with a
		// 404 error message.
		if(is_null($this->route))
		{
			$this->abort(404);
		}

		// Otherwise, let's attempt to register the detected route.
		else
		{
			try
			{
				$router->controller($this->route->route, $this->route->controller);
			}

			// If the controller does not exist, Laravel will
			// throw an exception. we'll silently kill the exception
			// since there might be a custom route already set.
			catch(\ReflectionException $e) {}
		}
	}

	/**
	 * Set the site's current theme.
	 *
	 * @param  string  $theme
	 * @return void
	 */
	public function setTheme($theme)
	{
		$this['theme.path'] = $this['path.base'].'/themes/'.$theme;

		$this['view.finder']->setThemePath($this['theme.path']);
		$this['plugins']->theme->setTheme($theme);
	}

	/**
	 * Determine if the current request is the home page.<commit_msg>Added a getTheme method to the Application class<commit_after><?php namespace Anvil;

use Anvil\Auth\AuthManager as Auth;
use Anvil\Routing\Inspector\Inspector;

use Illuminate\Http\Request;
use Illuminate\Routing\Router;
use Illuminate\Foundation\Application as IlluminateApplication;

class Application extends IlluminateApplication {

	/**
	 * The route detected from the requested URI.
	 *
	 * @var Anvil\Routing\Inspector\Route
	 */
	protected $route;

	/**
	 * The current theme for the website.
	 *
	 * @var string
	 */
	protected $theme;

	/**
	 * Create a route to the detected current controller.
	 *
	 * @param  Illuminate\Http\Request    $request
	 * @param  Anvil\Routing\Inspector    $inspector
	 * @param  Illuminate\Routing\Router  $router
	 * @return void
	 */
	public function start(Request $request, Inspector $inspector, Router $router)
	{
		// Let's pass the request to the inspector. The inspector
		// will determine which route and controller that should
		// respond to the current request.
		$this->route = $inspector->inspect($request);

		// If the route is null, then the inspector could not find
		// a matching route and controller. Let's just abort with a
		// 404 error message.
		if(is_null($this->route))
		{
			$this->abort(404);
		}

		// Otherwise, let's attempt to register the detected route.
		else
		{
			try
			{
				$router->controller($this->route->route, $this->route->controller);
			}

			// If the controller does not exist, Laravel will
			// throw an exception. we'll silently kill the exception
			// since there might be a custom route already set.
			catch(\ReflectionException $e) {}
		}
	}

	/**
	 * Set the site's current theme.
	 *
	 * @param  string  $theme
	 * @return void
	 */
	public function setTheme($theme)
	{
		$this->theme = $theme;

		// Todo: remove the stuff below
		$this['theme.path'] = $this['path.base'].'/themes/'.$theme;

		$this['view.finder']->setThemePath($this['theme.path']);
		$this['plugins']->theme->setTheme($theme);
	}

	/**
	 * Fetch the current theme.
	 *
	 * @return string
	 */
	public function theme()
	{
		return $this->theme;
	}

	/**
	 * Determine if the current request is the home page.
{'fraction_non_alphanumeric': 0.12472324723247233, 'fraction_numerical': 0.002952029520295203, 'mean_word_length': 3.3026455026455026, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '955026', 'n_tokens_mistral': 1341, 'n_tokens_neox': 1208, 'n_words': 382}