<commit_before><?php
/**
 * @author: KentProjects <<EMAIL>>
 * @license: Copyright KentProjects
 * @link: http://kentprojects.com
 */
final class Controller_Me extends Controller
{
	/**
	 * @var string
	 */
	protected $authentication = Auth::USER;

	/**
	 * /me
	 * /me/:id
	 *
	 * Get a collection of information for the current user.
	 *
	 * @throws HttpStatusException
	 * @return void
	 */
	public function action_index()
	{
		$this->validateMethods(Request::GET);

		if ($this->request->param("id") !== null)
		{
			throw new HttpStatusException(400, "No ID should be passed to the ME controller.");
		}

		$user = $this->auth->getUser();
		if ($user->isStudent())
		{
			$details = array(
				"group" => null,
				"project" => null,
				"user" => $user
			);

			$details["group"] = Model_Group::getByUser($user);
			if (!empty($details["group"]))
			{
				$details["project"] = Model_Project::getByGroup($details["group"]);
			}
		}
		else
		{
			$details = array(
				"user" => $user
			);
		}

		$this->response->status(200);
		$this->response->body($details);
	}
}<commit_msg>I believe this is all working :)<commit_after><?php
/**
 * @author: KentProjects <<EMAIL>>
 * @license: Copyright KentProjects
 * @link: http://kentprojects.com
 */
final class Controller_Me extends Controller
{
	/**
	 * @var string
	 */
	protected $authentication = Auth::USER;

	/**
	 * /me
	 * /me/:id
	 *
	 * Get a collection of information for the current user.
	 *
	 * @throws HttpStatusException
	 * @return void
	 */
	public function action_index()
	{
		$this->validateMethods(Request::GET);

		if ($this->request->param("id") !== null)
		{
			throw new HttpStatusException(400, "No ID should be passed to the ME controller.");
		}

		$this->response->status(200);
		$this->response->body($this->get($this->auth->getUser()));
	}

	/**
	 * @param Model_User $user
	 * @throws CacheException
	 * @return array
	 */
	protected function get(Model_User $user)
	{
		$cacheKey = Cache::PREFIX . "me." . $user->getId();
		$details = Cache::get($cacheKey);
		if (empty($details))
		{
			$details = $this->getData($user);
			Cache::set($cacheKey, $details);
		}
		return $details;
	}

	/**
	 * @param Model_User $user
	 * @return array
	 */
	protected function getData(Model_User $user)
	{
		if ($user->isStudent())
		{
			$details = array(
				"group" => null,
				"project" => null,
				"user" => $user
			);

			$details["group"] = Model_Group::getByUser($user);
			if (!empty($details["group"]))
			{
				$details["project"] = Model_Project::getByGroup($details["group"]);
			}
		}
		else
		{
			$details = array(
				"user" => $user
			);
		}
		return $details;
	}
}
{'fraction_non_alphanumeric': 0.18531073446327684, 'fraction_numerical': 0.004519774011299435, 'mean_word_length': 3.33278955954323, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 38, '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': '4467442', 'n_tokens_mistral': 1027, 'n_tokens_neox': 883, 'n_words': 196}