Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
InvalidAnswerDataException
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getQuestionName
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3declare( strict_types=1 );
4
5namespace MediaWiki\Extension\CampaignEvents\Questions;
6
7use Exception;
8
9class InvalidAnswerDataException extends Exception {
10    private string $questionName;
11
12    public function __construct( string $questionName ) {
13        parent::__construct( "Invalid answer for question $questionName" );
14        $this->questionName = $questionName;
15    }
16
17    /**
18     * Returns the name of the question corresponding to an invalid answer. This might be an HTMLForm `name` attribute,
19     * or some other kind of name, depending on the context.
20     *
21     * @return string
22     */
23    public function getQuestionName(): string {
24        return $this->questionName;
25    }
26}