<commit_before><?php
namespace Poll\PollBundle\Entity;

abstract class QuestionImpl extends PollItemImpl implements Question {

	/** @var Collection */
	protected $items;

	/**
	 * 
	 * @return string
	 */
	public function getQuestion() {

	}

	/**
	 * 
	 * @param string $question
	 * @return Question
	 */
	public function setQuestion($question) {

	}

	/**
	 * 
	 * @param Answer $answer
	 * @return Question
	 */
	public function addAnswer(Answer $answer) {

	}

	/**
	 * 
	 * @param Answer $answer
	 * @return Question
	 */
	public function removeAnswer(Answer $answer) {

	}

	/**
	 * 
	 * @return array[Answer]
	 */
	public function getAnswers() {

	}

	/**
	 * 
	 * @param string $id
	 * @return Question
	 * @throws ItemDoesNotExistException
	 */
	public function getAnswer($id) {

	}

	/**
	 * Overi, ze mezi odpovedmi je i odpoved
	 * @param Answer $answer
	 * @return boolean
	 */
	public function hasAnswer(Answer $answer) {
		
	}
}<commit_msg>implementation of class QuestionImpl<commit_after><?php
namespace Poll\PollBundle\Entity;

use Poll\PollBundle\Common\Collection;

/**
 * Question implementation class
 * @author AnaBalica
 */
abstract class QuestionImpl extends PollItemImpl implements Question {

	/** @var Collection */
	protected $answers;

	/** @var string */
	protected $question;

	public function __construct() {
		parent::__construct();
		$this->answers = Collection();
	}

	/**
	 * Get the question string
	 * @return string
	 */
	public function getQuestion() {
		return $this->question;
	}

	/**
	 * Set the question string
	 * @param string $question
	 * @return Question
	 */
	public function setQuestion($question) {
		if (empty($question))
			throw new Exception("The question cannot be empty. Please provide a string.")
		$this->question = $question;
		return $this;
	}

	/**
	 * Add an answer to the question
	 * @param Answer $answer
	 * @return Question
	 */
	public function addAnswer(Answer $answer) {
		$this->answers->addItem($answer, true);
		return $this;
	}

	/**
	 * Remove the answer from the questions
	 * @param Answer $answer
	 * @return Question
	 */
	public function removeAnswer(Answer $answer) {
		$this->answers->removeItem($answer, true);
		return $this;
	}

	/**
	 * Get all the answers to the question
	 * @return array[Answer]
	 */
	public function getAnswers() {
		return $this->items->getItems();
	}

	/**
	 * Get an answer according to its id
	 * @param string $id
	 * @return Question
	 * @throws ItemDoesNotExistException
	 */
	public function getAnswer($id) {
		return $this->items->getItem($id);
	}

	/**
	 * Check if an answer is present
	 * @param Answer $answer
	 * @return boolean
	 */
	public function hasAnswer(Answer $answer) {
		return $this->items->hasItem($answer);
	}
}
{'fraction_non_alphanumeric': 0.13158851326790258, 'fraction_numerical': 0.0, 'mean_word_length': 3.3338582677165354, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, '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': '2756101', 'n_tokens_mistral': 929, 'n_tokens_neox': 806, 'n_words': 239}