<commit_before><?php
/**
 * @author: KentProjects <<EMAIL>>
 * @license: Copyright KentProjects
 * @link: http://kentprojects.com
 */
class Model_Year extends Model_Abstract
{
	/**
	 * @param int $id
	 * @return Model_Year
	 */
	public static function getById($id)
	{
		$statement = Database::prepare("SELECT `year` AS 'id' FROM `Year` WHERE `year` = ?", "i", __CLASS__);
		return $statement->execute($id)->singleton();
	}

	/**
	 * @var int(4)
	 */
	protected $id;

	/**
	 * @param Model_User $user
	 * @return bool
	 */
	public function addStaff(Model_User $user)
	{
		if (!$user->isStaff())
		{
			throw new InvalidArgumentException("This user is not a member of staff");
		}
		$statement = Database::prepare(
			"INSERT INTO `User_Year_Map` (`user_id`, `year`)
			VALUES (?, ?)",
			"ii");
		return $statement->execute($user->getId(), $this->id)->affected_rows == 1;

	}

	/**
	 * @return int
	 */
	public function getId()
	{
		return $this->id;
	}

	/**
	 * @return Model_User[]
	 */
	public function getStaff()
	{
		$users = array();
		$statement = Database::prepare("SELECT `user_id` FROM `User_Year_Map` WHERE `year` = ?", "i");
		$user_ids = $statement->execute($this->id)->singlevals();
		foreach ($user_ids as $user_id)
		{
			$user = Model_Staff::getById($user_id);
			if (!empty($user))
			{
				$users[] = $user;
			}
		}
		return $users;
	}

	/**
	 * Rather than return an array (which will become an object), return an int.
	 *
	 * @return int
	 */
	public function jsonSerialize()
	{
		return $this->getId();
	}

	/**
	 * @param Model_User $user
	 * @return bool
	 */
	public function removeStaff(Model_User $user)
	{
		/**
		 * When you run an INSERT, UPDATE or DELETE, you will get a _Database_State back instead of a _Database_Result.
		 * You can use this to determine if the query was successful or not.
		 * Also, $user->isStaff() is valid. Just sayin'.
		 * Also also, delete this.
		 */
	}
}<commit_msg>Filled out removeStaff() method and made some minor formatting changes<commit_after><?php
/**
 * @author: KentProjects <<EMAIL>>
 * @license: Copyright KentProjects
 * @link: http://kentprojects.com
 */
class Model_Year extends Model_Abstract
{
	/**
	 * @param int $id
	 * @return Model_Year
	 */
	public static function getById($id)
	{
		$statement = Database::prepare("SELECT `year` AS 'id' FROM `Year` WHERE `year` = ?", "i", __CLASS__);
		return $statement->execute($id)->singleton();
	}

	/**
	 * @var int(4)
	 */
	protected $id;

	/**
	 * @param Model_User $user
	 * @return bool
	 */
	public function addStaff(Model_User $user)
	{
		if (!$user->isStaff())
		{
			throw new InvalidArgumentException("This user is not a member of staff");
		}
		$statement = Database::prepare(
			"INSERT INTO `User_Year_Map` (`user_id`, `year`)
			VALUES (?, ?)",
			"ii"
		);
		return $statement->execute($user->getId(), $this->id)->affected_rows == 1;
	}

	/**
	 * @return int
	 */
	public function getId()
	{
		return $this->id;
	}

	/**
	 * @return Model_User[]
	 */
	public function getStaff()
	{
		$users = array();
		$statement = Database::prepare("SELECT `user_id` FROM `User_Year_Map` WHERE `year` = ?", "i");
		$user_ids = $statement->execute($this->id)->singlevals();
		foreach ($user_ids as $user_id)
		{
			$user = Model_Staff::getById($user_id);
			if (!empty($user))
			{
				$users[] = $user;
			}
		}
		return $users;
	}

	/**
	 * Rather than return an array (which will become an object), return an int.
	 *
	 * @return int
	 */
	public function jsonSerialize()
	{
		return $this->getId();
	}

	/**
	 * @param Model_User $user
	 * @return bool
	 */
	public function removeStaff(Model_User $user)
	{
		if (!$user->isStaff())
		{
			throw new InvalidArgumentException("This user is not a member of staff");
		}
		$statement = Database::prepare(
			"DELETE FROM `User_Year_Map` WHERE `user_id` = ? AND `year` = ?", "ii"
		);
		return $statement->execute($user->getId(), $this->id)->affected_rows == 1;
	}
}
{'fraction_non_alphanumeric': 0.17318435754189945, 'fraction_numerical': 0.0012696800406297613, 'mean_word_length': 3.4761363636363636, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 37, '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': '4069266', 'n_tokens_mistral': 1493, 'n_tokens_neox': 1326, 'n_words': 352}