Skip to content
AnswerValueNotExist.php 1.36 KiB
Newer Older
<?php

/**
 * Class QuestionNotReachable
Michael Jansen's avatar
Michael Jansen committed
 * @package
 *
 * Date: 25.03.13
 * Time: 15:15
 * @author Thomas Joußen <tjoussen@databay.de>
Michael Jansen's avatar
Michael Jansen committed
 */
class AnswerValueNotExist extends \RuntimeException
{
Michael Jansen's avatar
Michael Jansen committed
    /**
     * @var int
     */
    protected $question_index;
Michael Jansen's avatar
Michael Jansen committed
    /**
     * @var string
     */
    protected $value;
Michael Jansen's avatar
Michael Jansen committed
    /**
     * @var int
     */
    protected $answer_index;
Michael Jansen's avatar
Michael Jansen committed
    /**
     * @param int $question_index
     * @param string $value
     * @param int $answer_index
     */
    public function __construct($question_index, $value, $answer_index = null)
    {
        $this->question_index = $question_index;
        $this->answer_index = $answer_index;
        $this->value = $value;
Michael Jansen's avatar
Michael Jansen committed
        $message = 'The value "%s" does not exist for the question Q%s[%s]';
        if ($this->answer_index === null) {
            $message = 'The value "%s" does not exist for the question Q%s';
        }
Michael Jansen's avatar
Michael Jansen committed
        parent::__construct(
            sprintf($message, $this->question_index, $value, $this->answer_index)
        );
    }
Michael Jansen's avatar
Michael Jansen committed
    /**
     * @return int
     */
    public function getQuestionIndex()
    {
        return $this->question_index;
    }
Michael Jansen's avatar
Michael Jansen committed
    /**
     * @return int
     */
    public function getAnswerIndex()
    {
        return $this->answer_index;
    }
Michael Jansen's avatar
Michael Jansen committed
    /**
     * @return string
     */
    public function getValue()
    {
        return $this->value;
    }
}