Adds an answer.

@param Answer $answer
334465
public function addAnswer(Answer $answer)
    {
        if (!$this->answers->contains($answer)) {
            $this->answers->add($answer);
            $answer->setPaper($this);
        }
    }
1221996
public function addParameter(Parameter $parameter) {
        $parameters = $this->getParameters();
        $parameters[] = $parameter;
        $this->setParameters($parameters);
    }
15930
public function addAnswer(\Lyon1\Bundle\PoobleBundle\Entity\SurveyAnswer $answer)
    {
        $this->answers[] = $answer;

        return $this;
    }
186903
public function correctAnswer(AbstractItem $question, $answer)
    {
        $corrected = new CorrectedAnswer();
        foreach ($question->getKeywords() as $keyword) {
            if ($this->containKeyword($answer, $keyword)) {
                if (0 < $keyword->getScore()) {
                    $corrected->addExpected($keyword);
                } else {
                    $corrected->addUnexpected($keyword);
                }
            } elseif (0 < $keyword->getScore()) {
                $corrected->addMissing($keyword);
            }
        }

        return $corrected;
    }
80614
protected function parseAnswerLine(string $answer)
    {
        if (is_null($this->question)) {
            throw new SyntaxException(_('辞書は「Q,」で始めなければなりません。'));
        } elseif ($this->answers) {
            $this->answers .= ",$answer";
        } else {
            $this->answers = $answer;
        }
    }
438307
public function actionAdd()
	{
		Question::confirm(null, 1);
		$collection = \App::$domain->rbac->rule->searchInAllApps();
		$rules = \App::$domain->rbac->rule->insertBatch($collection);
		if($rules) {
			Output::items($rules, "Added " . count($rules) . " rules");
		} else {
			Output::block("All rules exists!");
		}
	}
968994
public boolean add(ConceptMap answer, ConceptMap answerIndex){
        Index ind = Index.of(answerIndex.vars());
        if (ind.equals(index)) {
            return indexedAnswers.put(answerIndex, answer);
        }
        throw new IllegalStateException("Illegal index: " + answerIndex + " indices: " + index);
    }
663194
protected function addStatement(string $key, $value): void
    {
        if (array_key_exists($key, $this->statements) === false) {
            $this->statements[$key] = (array)$value;
        } else {
            $this->statements[$key] = array_merge($this->statements[$key], (array)$value);
        }
    }
603686
public function correctAnswer(AbstractItem $question, $answer)
    {
        $corrected = new CorrectedAnswer();
        $rows = $question->getRows()->toArray();

        if (!is_null($answer)) {
            foreach ($answer as $answerRow) {
                $hasOdd = false;
                // Search for odd items
                foreach ($answerRow as $answerItem) {
                    $odd = $question->getOddItem($answerItem);

                    if (!empty($odd)) {
                        $corrected->addUnexpected($odd);
                        $hasOdd = true;
                    }
                }

                if (!$hasOdd) {
                    // Search for a defined row for the user answer
                    $row = $this->findRowByAnswer($answerRow, $rows);
                    if (!empty($row)) {
                        // Row found
                        if (0 < $row->getScore()) {
                            $corrected->addExpected($row);
                        } else {
                            $corrected->addUnexpected($row);
                        }
                    } else {
                        // user answer is not a defined one, apply default penalty if exist
                        if ($question->getPenalty()) {
                            $corrected->addPenalty(new GenericPenalty($question->getPenalty()));
                        }
                    }
                }
            }
        }

        if (!empty($rows)) {
            // There are defined rows that have not been found
            foreach ($rows as $row) {
                /** @var GridRow $row */
                if (0 < $row->getScore()) {
                    $corrected->addMissing($row);
                }
            }
        }

        return $corrected;
    }
755047
public function addOption($option, $value = null)
    {
        if (is_array($option)) {
            $this->options = $option + $this->options;
        } else {
            $this->options[$option] = $value;
        }
    }
46704
public function add_highlight_content($response) {
        if (!isset($response->highlighting)) {
            // There is no highlighting to add.
            return;
        }

        $highlightedobject = $response->highlighting;
        foreach ($response->response->docs as $doc) {
            $x = $doc->id;
            $highlighteddoc = $highlightedobject->$x;
            $this->merge_highlight_field_values($doc, $highlighteddoc);
        }
    }
68738
public function addRelation($relation)
    {
        $relations = $this->getRelations();
        array_push($relations, $relation);
        $this->setRelations($relations);
    }
942590
def add_answer(self, vote, rationale):
        
        self.raw_answers.append({
            VOTE_KEY: vote,
            RATIONALE_KEY: rationale,
        })
631832
public function createAnswer(int $pollId, string $answer): PodiumResponse
    {
        /* @var $pollAnswerForm AnswerFormInterface */
        $pollAnswerForm = $this->getAnswerForm();

        $pollAnswerForm->setPollId($pollId);
        $pollAnswerForm->setAnswer($answer);

        return $pollAnswerForm->create();
    }
966982
public function addQuestion(ServerQuestion $question)
    {
        if ($this->questions->contains($question) === false) {
            $question->setServer($this);
            $this->questions->add($question);
        }

        return $this;
    }
509514
public function add($comment)
    {
        $comments = $this->session->get('comments', []);
        $comments[] = $comment;
        $this->session->set('comments', $comments);
    }
1043167
public function removeAnswer(\Lyon1\Bundle\PoobleBundle\Entity\SurveyAnswer $answer)
    {
        $this->answers->removeElement($answer);
    }